/* =============================================
   MEV LyT — Premium Light Theme
   Florencio Varela Institutional Colors
   ============================================= */

/* ── CSS Variables ── */
:root {
    /* Institutional Greens */
    --fv-green: #1B7A43;
    --fv-green-dark: #0f5a2f;
    --fv-green-light: #27a85b;
    --sidebar-bg-start: #0f3d22;
    --sidebar-bg-end: #0a2e18;

    /* Light theme */
    --bg-primary: #F5F7FA;
    --bg-card: #FFFFFF;
    --bg-hover: #f0f4f8;

    /* Text */
    --text-primary: #1a2332;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-white: #ffffff;

    /* Borders */
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;

    /* Accent Colors */
    --accent-blue: #3b82f6;
    --accent-red: #ef4444;
    --accent-orange: #f59e0b;
    --accent-purple: #8b5cf6;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.15);

    /* Sizing */
    --sidebar-width: 240px;
    --header-height: 64px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
}

/* ── Reset ── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

input,
select,
textarea {
    font-family: inherit;
    font-size: inherit;
}

table {
    border-collapse: collapse;
    width: 100%;
}

/* =============================================
   SIDEBAR
   ============================================= */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--sidebar-bg-start) 0%, var(--sidebar-bg-end) 100%);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 1.8rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.logo-text h1 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-white);
    letter-spacing: -0.3px;
}

.logo-text span {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 3px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    box-shadow: inset 3px 0 0 var(--fv-green-light);
}

.nav-icon {
    font-size: 1.15rem;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.cron-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--fv-green-light);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(39, 168, 91, 0.4);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(39, 168, 91, 0);
    }
}

.status-label {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-time {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.7);
}

.sidebar-logout {
    padding: 8px 16px 16px;
}

.btn-logout {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    border-radius: var(--radius-sm);
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
    font-size: 0.82rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #fff;
}

/* =============================================
   MAIN CONTENT
   ============================================= */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.top-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.page-title h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.datetime {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.mobile-menu-btn {
    display: none;
    font-size: 1.5rem;
    padding: 4px 8px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--fv-green);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

#userName {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* =============================================
   CONTENT SECTIONS
   ============================================= */
.content-section {
    display: none;
    padding: 24px 28px;
    animation: fadeSlideIn 0.35s ease;
}

.content-section.active {
    display: block;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =============================================
   STATS GRID
   ============================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: relative;
    transition: all 0.25s ease;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: var(--radius) 0 0 var(--radius);
}

.stat-card-primary::before {
    background: var(--fv-green);
}

.stat-card-success::before {
    background: var(--accent-blue);
}

.stat-card-warning::before {
    background: var(--accent-orange);
}

.stat-card-info::before {
    background: var(--accent-purple);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    font-size: 2rem;
    opacity: 0.9;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.stat-badge {
    position: absolute;
    top: 12px;
    right: 14px;
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg-primary);
    padding: 3px 8px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

/* =============================================
   DASHBOARD GRID
   ============================================= */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* =============================================
   PANELS
   ============================================= */
.panel {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
}

.panel-body {
    padding: 16px 20px;
}

.panel-body.no-padding {
    padding: 0;
}

.link-action {
    font-size: 0.8rem;
    color: var(--fv-green);
    font-weight: 500;
    transition: color 0.2s;
}

.link-action:hover {
    color: var(--fv-green-dark);
}

/* =============================================
   BUTTONS
   ============================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--fv-green);
    color: #fff;
}

.btn-primary:hover {
    background: var(--fv-green-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(27, 122, 67, 0.3);
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-danger {
    background: var(--accent-red);
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-success {
    background: #16a34a;
    color: #fff;
}

.btn-success:hover {
    background: #15803d;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.btn-xs {
    padding: 4px 10px;
    font-size: 0.74rem;
    border-radius: var(--radius-xs);
}

.btn-icon {
    padding: 8px;
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--bg-primary);
}

.btn-action {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xs);
    font-size: 0.9rem;
    transition: all 0.15s ease;
}

.btn-action:hover {
    background: var(--bg-primary);
    transform: scale(1.1);
}

.btn-action-danger:hover {
    background: #fee2e2;
}

.actions-cell {
    display: flex;
    gap: 4px;
    justify-content: center;
}

/* =============================================
   FORMS
   ============================================= */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    color: var(--text-primary);
    background: var(--bg-card);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--fv-green);
    box-shadow: 0 0 0 3px rgba(27, 122, 67, 0.12);
}

.form-input::placeholder {
    color: var(--text-muted);
}

textarea.form-input {
    resize: vertical;
    min-height: 70px;
}

select.form-input {
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    margin-top: 10px;
}

.modal-form .form-group {
    margin-bottom: 12px;
}

/* =============================================
   FILTERS BAR
   ============================================= */
.filters-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    padding: 0 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: border-color 0.2s;
}

.search-box:focus-within {
    border-color: var(--fv-green);
    box-shadow: 0 0 0 3px rgba(27, 122, 67, 0.08);
}

.search-icon {
    font-size: 1.1rem;
    opacity: 0.5;
}

.search-box input {
    flex: 1;
    border: none;
    outline: none;
    padding: 10px 0;
    font-size: 0.88rem;
    background: transparent;
}

.select-filter {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    background: var(--bg-card);
    cursor: pointer;
    min-width: 170px;
}

/* =============================================
   DATA TABLE
   ============================================= */
.table-responsive {
    overflow-x: auto;
}

.data-table th {
    padding: 12px 16px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    text-align: left;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 14px 16px;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.data-table tr {
    cursor: pointer;
    transition: background 0.15s;
}

.data-table tbody tr:hover {
    background: var(--bg-hover);
}

.data-table .center {
    text-align: center;
}

.loading-cell {
    text-align: center;
    padding: 40px !important;
    color: var(--text-muted);
}

.causa-num {
    font-weight: 600;
    color: var(--fv-green);
    font-size: 0.83rem;
}

.caratula-text {
    font-size: 0.82rem;
}

.juzgado-text {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.fecha-text {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 24px;
    padding: 0 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* ── Status Badges ── */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: capitalize;
}

.status-activo {
    background: #dcfce7;
    color: #166534;
}

.status-paralizado {
    background: #fef3c7;
    color: #92400e;
}

.status-archivado {
    background: #f1f5f9;
    color: #475569;
}

.status-finalizado {
    background: #dbeafe;
    color: #1e40af;
}

/* =============================================
   TIMELINE
   ============================================= */
.timeline-item {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background 0.2s;
}

.timeline-item:last-child {
    border-bottom: none;
}

.timeline-item:hover {
    background: var(--bg-hover);
    margin: 0 -20px;
    padding-left: 20px;
    padding-right: 20px;
    border-radius: var(--radius-sm);
}

.timeline-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--fv-green);
    margin-top: 6px;
    flex-shrink: 0;
}

.timeline-content {
    flex: 1;
    min-width: 0;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.timeline-causa {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--fv-green);
}

.timeline-fecha {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.timeline-despacho {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.timeline-juzgado {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* =============================================
   MODALS — Premium Animated
   ============================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    transform: translateY(30px) scale(0.95);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal-lg {
    max-width: 750px;
}

.modal-sm {
    max-width: 420px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
}

.modal-header-danger {
    background: #fef2f2;
    border-bottom-color: #fecaca;
}

.modal-header-danger h3 {
    color: var(--accent-red);
}

.modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 24px;
    border-top: 1px solid var(--border-color);
}

.modal-close {
    font-size: 1rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: all 0.15s;
}

.modal-close:hover {
    background: var(--bg-primary);
}

/* ── Modal Tabs ── */
.modal-tabs {
    display: flex;
    padding: 0 24px;
    gap: 4px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.tab-btn {
    padding: 12px 18px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.tab-btn.active {
    color: var(--fv-green);
    border-bottom-color: var(--fv-green);
}

/* =============================================
   DETAIL VIEW (Inside modal)
   ============================================= */
.detail-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.detail-field {}

.detail-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--fv-green);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 4px;
}

.detail-value {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.detail-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
}

.detail-notas {
    background: #f8fafc;
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
    white-space: pre-wrap;
}

/* ── Movimientos list in modal ── */
.movimientos-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mov-item {
    padding: 12px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    transition: transform 0.15s;
}

.mov-item:hover {
    transform: translateX(4px);
}

.mov-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.mov-header strong {
    font-size: 0.82rem;
    color: var(--fv-green);
}

.mov-origen {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    background: var(--bg-card);
    padding: 2px 8px;
    border-radius: 10px;
}

.mov-text {
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.mov-org {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* =============================================
   PLAZOS
   ============================================= */
.plazos-header {
    margin-bottom: 16px;
}

.plazos-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.plazo-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-card);
}

.plazo-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.plazo-indicator {
    width: 4px;
    height: 36px;
    border-radius: 4px;
    flex-shrink: 0;
}

.plazo-ok .plazo-indicator {
    background: #22c55e;
}

.plazo-proximo .plazo-indicator {
    background: var(--accent-orange);
}

.plazo-urgente .plazo-indicator {
    background: var(--accent-red);
    animation: pulse-urgente 1s ease infinite;
}

.plazo-vencido .plazo-indicator {
    background: #dc2626;
}

@keyframes pulse-urgente {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.plazo-info {
    flex: 1;
    min-width: 0;
}

.plazo-tipo {
    font-size: 0.82rem;
    font-weight: 600;
    display: block;
}

.plazo-causa {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.plazo-countdown {
    text-align: right;
    flex-shrink: 0;
}

.plazo-days {
    display: block;
    font-size: 1rem;
    font-weight: 800;
}

.plazo-ok .plazo-days {
    color: #16a34a;
}

.plazo-proximo .plazo-days {
    color: var(--accent-orange);
}

.plazo-urgente .plazo-days {
    color: var(--accent-red);
}

.plazo-vencido .plazo-days {
    color: #dc2626;
}

.plazo-date {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.plazo-card {
    padding: 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    border-left: 4px solid;
    background: var(--bg-card);
    transition: transform 0.15s;
}

.plazo-card:hover {
    transform: translateX(3px);
}

.plazo-card.plazo-ok {
    border-left-color: #22c55e;
}

.plazo-card.plazo-proximo {
    border-left-color: var(--accent-orange);
}

.plazo-card.plazo-urgente {
    border-left-color: var(--accent-red);
    background: #fff5f5;
}

.plazo-card.plazo-vencido {
    border-left-color: #dc2626;
    background: #fef2f2;
}

.plazo-card.plazo-cumplido {
    border-left-color: #94a3b8;
    opacity: 0.7;
}

.plazo-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.plazo-tipo-badge {
    font-size: 0.82rem;
    font-weight: 700;
}

.plazo-status-badge {
    font-size: 0.72rem;
    font-weight: 700;
}

.plazo-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.plazo-causa-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.plazo-dates {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.plazo-actions {
    display: flex;
    gap: 6px;
}

/* =============================================
   CALENDAR
   ============================================= */
.calendar-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 12px 0;
}

.calendar-header-bar h3 {
    font-size: 1.2rem;
    font-weight: 700;
}

.calendar-grid {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
}

.cal-weekday {
    padding: 10px;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.cal-day {
    min-height: 70px;
    padding: 8px;
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    cursor: default;
    transition: background 0.15s;
}

.cal-day:nth-child(7n) {
    border-right: none;
}

.cal-day:hover {
    background: var(--bg-hover);
}

.cal-empty {
    background: #fafbfc;
    cursor: default;
}

.cal-empty:hover {
    background: #fafbfc;
}

.cal-day-num {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.cal-today {
    background: #f0fdf4;
}

.cal-today .cal-day-num {
    color: var(--fv-green);
    font-weight: 800;
}

.cal-plazo {
    background: #eff6ff;
}

.cal-vencido {
    background: #fef2f2;
}

.cal-dots {
    display: flex;
    gap: 3px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.cal-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--fv-green);
}

.cal-vencido .cal-dot {
    background: var(--accent-red);
}

/* =============================================
   TOAST NOTIFICATIONS
   ============================================= */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-lg);
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
    opacity: 0;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-success {
    background: #16a34a;
    color: #fff;
}

.toast-error {
    background: var(--accent-red);
    color: #fff;
}

.toast-info {
    background: var(--accent-blue);
    color: #fff;
}

.toast-icon {
    font-weight: 800;
}

/* =============================================
   EMPTY STATE
   ============================================= */
.empty-state {
    text-align: center;
    padding: 30px 20px;
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
    opacity: 0.5;
}

.empty-state h4 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.empty-state p {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* =============================================
   LOADING
   ============================================= */
.loading-placeholder {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--fv-green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* =============================================
   CONFIG
   ============================================= */
.config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.config-panel .form-input[readonly] {
    background: var(--bg-primary);
    color: var(--text-muted);
    cursor: default;
}

.config-badge {
    font-size: 0.7rem;
    padding: 3px 10px;
    border-radius: 20px;
    background: #dbeafe;
    color: #1e40af;
    font-weight: 600;
}

.cron-command {
    background: var(--bg-primary);
    padding: 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.cron-command label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.cron-command code {
    font-size: 0.78rem;
    color: var(--text-primary);
    word-break: break-all;
}

/* =============================================
   SIDEBAR OVERLAY (Mobile)
   ============================================= */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    z-index: 99;
    transition: opacity 0.3s, visibility 0.3s;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .config-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: block;
    }

    .top-header {
        padding: 0 14px;
    }

    .content-section {
        padding: 16px 14px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-value {
        font-size: 1.3rem;
    }

    .stat-icon {
        font-size: 1.5rem;
    }

    .stat-badge {
        display: none;
    }

    .filters-bar {
        flex-direction: column;
    }

    .select-filter {
        min-width: 100%;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .datetime {
        display: none;
    }

    .modal {
        width: 95%;
        max-height: 90vh;
        border-radius: var(--radius);
    }

    .detail-row {
        grid-template-columns: 1fr;
    }

    .cal-day {
        min-height: 50px;
        padding: 4px;
    }

    .cal-day-num {
        font-size: 0.72rem;
    }

    .header-actions {
        gap: 4px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .user-badge #userName {
        display: none;
    }

    .calendar-header-bar h3 {
        font-size: 1rem;
    }
}

/* =============================================
   PLAZO LEGAL INFO BOX (CPCC BA)
   ============================================= */
.plazo-legal-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 14px;
    margin-bottom: 14px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-left: 4px solid var(--fv-green);
    border-radius: var(--radius-sm);
    animation: fadeSlideIn 0.25s ease;
}

.legal-ref {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--fv-green-dark);
}

.legal-days {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: #fff;
    padding: 2px 10px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.legal-nota {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-style: italic;
}

/* =============================================
   BOARD TOGGLE BUTTON & BADGE
   ============================================= */
.board-toggle-btn {
    position: relative;
}

.board-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }
}

/* =============================================
   TICKER BAR
   ============================================= */
.ticker-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 20px;
    background: linear-gradient(135deg, #fefce8, #fef9c3);
    border-bottom: 1px solid #fde68a;
    overflow: hidden;
}

.ticker-label {
    font-size: 1rem;
    flex-shrink: 0;
}

.ticker-track {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.ticker-content {
    display: flex;
    gap: 40px;
    white-space: nowrap;
    animation: tickerScroll 25s linear infinite;
}

.ticker-content span {
    font-size: 0.78rem;
    font-weight: 500;
    color: #92400e;
}

@keyframes tickerScroll {
    0% {
        transform: translateX(100%);
    }

    100% {
        transform: translateX(-100%);
    }
}

.ticker-bar:hover .ticker-content {
    animation-play-state: paused;
}

/* =============================================
   BOARD PANEL (Slide-in from right)
   ============================================= */
.board-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.board-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.board-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 380px;
    max-width: 90vw;
    height: 100vh;
    background: var(--bg-card);
    border-left: 1px solid var(--border-color);
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.12);
    z-index: 999;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.board-panel.open {
    transform: translateX(0);
}

.board-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--fv-green-dark);
    color: #fff;
}

.board-panel-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
}

.board-panel-header .btn-icon {
    color: rgba(255, 255, 255, 0.8);
}

.board-panel-header .btn-icon:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
}

.board-add-form {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.board-form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
}

.board-colors {
    display: flex;
    gap: 8px;
}

.color-chip {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.color-chip input {
    display: none;
}

.color-chip.color-yellow {
    background: #fef3c7;
}

.color-chip.color-blue {
    background: #dbeafe;
}

.color-chip.color-red {
    background: #fee2e2;
}

.color-chip.active,
.color-chip:hover {
    border-color: var(--fv-green);
    transform: scale(1.15);
}

.board-notes {
    flex: 1;
    padding: 16px 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ── Post-it Cards ── */
.post-it {
    position: relative;
    padding: 16px 16px 12px;
    border-radius: 4px;
    box-shadow: 2px 3px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: fadeSlideIn 0.3s ease;
}

.post-it:hover {
    transform: translateY(-2px) rotate(-0.5deg);
    box-shadow: 3px 5px 14px rgba(0, 0, 0, 0.15);
}

.post-it.color-yellow {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
}

.post-it.color-blue {
    background: #dbeafe;
    border-left: 4px solid #3b82f6;
}

.post-it.color-red {
    background: #fee2e2;
    border-left: 4px solid #ef4444;
}

.post-it-pin {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.85rem;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.post-it-text {
    font-size: 0.85rem;
    line-height: 1.5;
    color: #1e293b;
    margin-bottom: 8px;
    word-break: break-word;
    white-space: pre-wrap;
}

.post-it-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
    color: #64748b;
}

.post-it-delete {
    font-size: 0.85rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    padding: 2px 4px;
    border-radius: 4px;
}

.post-it:hover .post-it-delete {
    opacity: 1;
}

.post-it-delete:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* =============================================
   GESTIONES — Stat Card Variants
   ============================================= */
.stat-card-warning {
    border-left: 4px solid #f59e0b;
}

.stat-card-warning .stat-icon {
    background: #fffbeb;
    color: #f59e0b;
}

.stat-card-danger {
    border-left: 4px solid #ef4444;
}

.stat-card-danger .stat-icon {
    background: #fef2f2;
    color: #ef4444;
}

.stat-card-success {
    border-left: 4px solid #22c55e;
}

.stat-card-success .stat-icon {
    background: #f0fdf4;
    color: #22c55e;
}

/* ── Priority Badges in Table ── */
.priority-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
}

.priority-badge.urgente {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.priority-badge.alta {
    background: #fff7ed;
    color: #ea580c;
    border: 1px solid #fed7aa;
}

.priority-badge.media {
    background: #fefce8;
    color: #ca8a04;
    border: 1px solid #fef08a;
}

.priority-badge.baja {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

/* ── Gestión Type Icons ── */
.gest-tipo-icon {
    font-size: 1.1rem;
}

/* =============================================
   RESPONSIVE: Board + Gestiones
   ============================================= */
@media (max-width: 768px) {
    .board-panel {
        width: 100%;
    }

    .gest-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .ticker-bar {
        padding: 4px 12px;
    }

    /* =============================================
   DOCUMENTOS - GALERÍA Y UPLOAD
   ============================================= */
    .gallery-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 16px;
        margin-top: 10px;
    }

    .file-card {
        background: #fff;
        border: 1px solid var(--border-color);
        border-radius: 6px;
        padding: 12px;
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        transition: transform 0.2s, box-shadow 0.2s;
        cursor: pointer;
        position: relative;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    }

    .file-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
        border-color: var(--fv-green);
    }

    .file-icon {
        font-size: 2.5rem;
        margin-bottom: 8px;
        color: var(--fv-green-dark);
    }

    .file-name {
        font-size: 0.85rem;
        font-weight: 600;
        color: var(--text-color);
        margin-bottom: 4px;
        word-break: break-all;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .file-meta {
        font-size: 0.7rem;
        color: var(--text-muted);
    }

    .file-actions {
        margin-top: 10px;
        display: flex;
        gap: 8px;
        width: 100%;
    }

    .file-actions button {
        flex: 1;
        padding: 4px;
        font-size: 0.75rem;
    }

    .upload-zone {
        border: 2px dashed #cbd5e1;
        border-radius: 6px;
        padding: 20px;
        text-align: center;
        background: #f8fafc;
        color: #64748b;
        cursor: pointer;
        transition: all 0.2s;
        margin-bottom: 15px;
    }

    .upload-zone.dragover {
        background: #e0f2fe;
        border-color: #3b82f6;
        color: #1e3a8a;
    }

    /* =============================================
   VISOR DE ARCHIVOS (LIGHTBOX)
   ============================================= */
    #visorContent img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    }

    #visorContent iframe {
        width: 100%;
        height: 100%;
        border: none;
        background: #fff;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    }

    /* =============================================
   EDITOR DE MODELOS (MEMBRETE OFICIAL)
   ============================================= */
    .a4-paper {
        background: #fff;
        width: 100%;
        max-width: 210mm;
        min-height: 297mm;
        margin: 0 auto;
        padding: 25mm 20mm;
        box-shadow: 0 5px 25px rgba(0, 0, 0, 0.1);
        position: relative;
        display: flex;
        flex-direction: column;
    }

    .membrete-oficial {
        display: flex;
        align-items: center;
        gap: 15px;
        border-bottom: 2px solid #1e293b;
        padding-bottom: 10px;
        margin-bottom: 25px;
    }

    .membrete-logo svg {
        color: #1e293b;
    }

    .membrete-textos h4 {
        font-size: 1.1rem;
        font-weight: 700;
        color: #1e293b;
        margin: 0;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .membrete-textos p {
        font-size: 0.85rem;
        color: #475569;
        margin: 0;
    }

    .editor-content {
        flex: 1;
        font-family: 'Times New Roman', Times, serif;
        font-size: 12pt;
        line-height: 1.6;
        color: #000;
        outline: none;
        padding: 10px 0;
    }

    .editor-content p {
        margin-bottom: 1em;
    }

    .membrete-footer {
        margin-top: 40px;
        border-top: 1px solid #cbd5e1;
        padding-top: 10px;
        text-align: center;
        font-size: 0.75rem;
        color: #64748b;
    }

    /* Print Specific Styles */
    @media print {
        body * {
            visibility: hidden;
        }

        .print-area,
        .print-area * {
            visibility: visible;
        }

        .print-area {
            position: absolute;
            left: 0;
            top: 0;
            width: 100%;
            margin: 0;
            padding: 0;
            box-shadow: none;
        }

        @page {
            margin: 0;
        }
    }
}