/* ============================================
   MEV Tracker — Dashboard Institucional
   Colores: Municipalidad de Florencio Varela
   Verde + Azul + Rojo + Blanco
   ============================================ */

/* ---- CSS Reset & Variables ---- */
:root {
    /* Colores Institucionales - Florencio Varela */
    --fv-green: #1B7A43;
    --fv-green-light: #25A05A;
    --fv-green-dark: #0F5C2E;
    --fv-blue: #1A5276;
    --fv-blue-light: #2471A3;
    --fv-red: #C0392B;
    --fv-gold: #D4A017;

    /* Colors */
    --bg-primary: #0a1a12;
    --bg-secondary: #0f2218;
    --bg-card: rgba(15, 34, 24, 0.85);
    --bg-glass: rgba(20, 45, 30, 0.6);
    --bg-hover: rgba(27, 122, 67, 0.08);

    --text-primary: #e0f0e6;
    --text-secondary: #8cb89e;
    --text-muted: #5a7d68;

    --accent-primary: var(--fv-green);
    --accent-primary-light: var(--fv-green-light);
    --accent-secondary: var(--fv-blue-light);
    --accent-gradient: linear-gradient(135deg, var(--fv-green) 0%, var(--fv-green-light) 50%, var(--fv-blue-light) 100%);

    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --info: var(--fv-blue-light);
    --info-bg: rgba(36, 113, 163, 0.1);

    --border-color: rgba(27, 122, 67, 0.15);
    --border-glass: rgba(255, 255, 255, 0.06);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px rgba(27, 122, 67, 0.15);

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --header-height: 72px;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Background ambient glow */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at 20% 50%, rgba(27, 122, 67, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(26, 82, 118, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(36, 113, 163, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

a {
    color: var(--accent-primary-light);
    text-decoration: none;
}

a:hover {
    color: var(--accent-primary);
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(27, 122, 67, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(27, 122, 67, 0.5);
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition-slow), width var(--transition-slow);
}

.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 28px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-gradient);
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(27, 122, 67, 0.3);
}

.logo-text h1 {
    font-size: 1.2rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.logo-text span {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    flex-direction: column;
    gap: 4px;
}

.sidebar-toggle span {
    width: 20px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: var(--transition-fast);
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.93rem;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--accent-gradient);
    border-radius: 0 3px 3px 0;
    transition: height var(--transition-normal);
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--bg-hover);
    color: var(--accent-primary-light);
}

.nav-item.active::before {
    height: 60%;
}

.nav-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

.cron-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-glass);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-glass);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.status-ok {
    background: var(--success);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
    animation: pulse-dot 2s infinite;
}

.status-dot.status-error {
    background: var(--danger);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.status-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.status-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Logout button in sidebar */
.sidebar-logout {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    background: rgba(192, 57, 43, 0.08);
    border: 1px solid rgba(192, 57, 43, 0.15);
    border-radius: var(--border-radius-sm);
    color: #E74C3C;
    font-family: var(--font-family);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-logout:hover {
    background: rgba(192, 57, 43, 0.15);
    border-color: rgba(192, 57, 43, 0.3);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    position: relative;
    z-index: 1;
    transition: margin-left var(--transition-slow);
}

/* ---- Top Header ---- */
.top-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    height: var(--header-height);
    background: rgba(10, 26, 18, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
}

.page-title h2 {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.page-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.datetime {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 6px 14px;
    background: var(--bg-glass);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-glass);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* User badge in header */
.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-glass);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-glass);
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.user-badge .user-avatar {
    width: 26px;
    height: 26px;
    background: var(--accent-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: white;
    font-weight: 700;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-family);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: 0 4px 12px rgba(27, 122, 67, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(27, 122, 67, 0.4);
}

.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.btn-icon {
    padding: 8px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.82rem;
}

.btn-xs {
    padding: 5px 10px;
    font-size: 0.75rem;
    border-radius: 6px;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-success {
    background: var(--success);
    color: #fff;
}

/* ============================================
   CONTENT SECTIONS
   ============================================ */
.content-section {
    display: none;
    padding: 28px 32px;
    animation: fadeInUp 0.3s ease;
}

.content-section.active {
    display: block;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   STATS CARDS
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 22px 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    transition: all var(--transition-normal);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 12px 12px 0 0;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
    border-color: rgba(27, 122, 67, 0.25);
}

.stat-card-primary::before {
    background: var(--accent-gradient);
}

.stat-card-success::before {
    background: linear-gradient(90deg, #22c55e, #16a34a);
}

.stat-card-warning::before {
    background: linear-gradient(90deg, var(--fv-gold), #B8860B);
}

.stat-card-info::before {
    background: linear-gradient(90deg, var(--fv-blue), var(--fv-blue-light));
}

.stat-icon {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm);
    flex-shrink: 0;
}

.stat-card-primary .stat-icon {
    background: rgba(27, 122, 67, 0.12);
}

.stat-card-success .stat-icon {
    background: var(--success-bg);
}

.stat-card-warning .stat-icon {
    background: var(--warning-bg);
}

.stat-card-info .stat-icon {
    background: var(--info-bg);
}

.stat-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
}

.stat-label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-badge {
    position: absolute;
    top: 18px;
    right: 18px;
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg-glass);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid var(--border-glass);
    font-weight: 500;
}

/* ============================================
   PANELS
   ============================================ */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    backdrop-filter: blur(10px);
    overflow: hidden;
    margin-bottom: 24px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h3 {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.panel-body {
    padding: 24px;
}

.panel-body.no-padding {
    padding: 0;
}

.link-action {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent-primary-light);
    transition: color var(--transition-fast);
}

.link-action:hover {
    color: var(--accent-primary);
}

/* ============================================
   TIMELINE
   ============================================ */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--fv-green), var(--border-color));
    border-radius: 2px;
}

.timeline-item {
    display: flex;
    gap: 20px;
    padding: 16px 0;
    position: relative;
    animation: fadeInUp 0.4s ease;
    animation-fill-mode: both;
}

.timeline-item:nth-child(1) {
    animation-delay: 0.05s;
}

.timeline-item:nth-child(2) {
    animation-delay: 0.1s;
}

.timeline-item:nth-child(3) {
    animation-delay: 0.15s;
}

.timeline-item:nth-child(4) {
    animation-delay: 0.2s;
}

.timeline-item:nth-child(5) {
    animation-delay: 0.25s;
}

.timeline-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--fv-green);
    border: 2px solid var(--bg-primary);
    flex-shrink: 0;
    margin-top: 6px;
    z-index: 2;
    position: relative;
    left: 16px;
    box-shadow: 0 0 8px rgba(27, 122, 67, 0.4);
}

.timeline-content {
    flex: 1;
    padding: 14px 18px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.timeline-content:hover {
    background: var(--bg-hover);
    border-color: rgba(27, 122, 67, 0.2);
    transform: translateX(4px);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    gap: 12px;
}

.timeline-causa {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--accent-primary-light);
}

.timeline-fecha {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    padding: 3px 8px;
    background: rgba(27, 122, 67, 0.08);
    border-radius: 4px;
}

.timeline-despacho {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 6px;
}

.timeline-juzgado {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ============================================
   DATA TABLE
   ============================================ */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    padding: 14px 18px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(10, 26, 18, 0.4);
    white-space: nowrap;
}

.data-table tbody tr {
    transition: background var(--transition-fast);
    cursor: pointer;
}

.data-table tbody tr:hover {
    background: var(--bg-hover);
}

.data-table tbody td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-glass);
    font-size: 0.88rem;
    vertical-align: middle;
}

.data-table .causa-num {
    font-weight: 600;
    color: var(--accent-primary-light);
    font-size: 0.82rem;
}

.data-table .caratula-text {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.data-table .juzgado-text {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.status-badge.activo {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.status-badge.paralizado {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.status-badge.archivado {
    background: rgba(107, 114, 128, 0.1);
    color: #9ca3af;
    border: 1px solid rgba(107, 114, 128, 0.2);
}

.status-badge.finalizado {
    background: var(--info-bg);
    color: var(--info);
    border: 1px solid rgba(36, 113, 163, 0.2);
}

.mov-count {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: var(--text-secondary);
}

.mov-count .count-badge {
    background: rgba(27, 122, 67, 0.12);
    color: var(--accent-primary-light);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
}

.fecha-text {
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.fecha-text.hoy {
    color: var(--success);
    font-weight: 600;
}

.loading-cell {
    text-align: center;
    padding: 40px !important;
    color: var(--text-muted);
}

/* ============================================
   FILTERS BAR
   ============================================ */
.filters-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 280px;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(27, 122, 67, 0.12);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.select-filter {
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.88rem;
    cursor: pointer;
    min-width: 180px;
    transition: all var(--transition-fast);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238cb89e' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.select-filter:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.select-filter option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ============================================
   CONFIG GRID
   ============================================ */
.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 24px;
}

.config-panel .panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.config-badge {
    font-size: 0.7rem;
    color: var(--accent-primary-light);
    background: rgba(27, 122, 67, 0.1);
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.88rem;
    transition: all var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    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: 60px;
}

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238cb89e' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

select.form-input option {
    background: var(--bg-secondary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 8px;
}

/* Toggle Switch */
.toggle-label {
    display: flex !important;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 0.88rem !important;
    color: var(--text-primary) !important;
}

.toggle-label input[type="checkbox"] {
    display: none;
}

.toggle-switch {
    width: 44px;
    height: 24px;
    background: var(--text-muted);
    border-radius: 12px;
    position: relative;
    transition: background var(--transition-fast);
    flex-shrink: 0;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform var(--transition-fast);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-label input:checked+.toggle-switch {
    background: var(--accent-primary);
}

.toggle-label input:checked+.toggle-switch::after {
    transform: translateX(20px);
}

/* Cron Command */
.cron-command {
    margin: 12px 0;
}

.cron-command label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.cron-command code {
    display: block;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.78rem;
    color: var(--accent-primary-light);
    word-break: break-all;
    user-select: all;
}

/* ============================================
   MODALS
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 640px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-close {
    font-size: 1.1rem !important;
    padding: 6px !important;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-form {
    max-width: 580px;
}

/* Modal Detail Fields */
.detail-field {
    margin-bottom: 16px;
}

.detail-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.detail-value {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 14px 20px;
    min-width: 280px;
    max-width: 380px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInRight 0.3s ease;
    font-size: 0.88rem;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.success {
    border-left: 3px solid var(--success);
}

.toast.error {
    border-left: 3px solid var(--danger);
}

.toast.info {
    border-left: 3px solid var(--info);
}

/* ============================================
   LOADING / SPINNERS
   ============================================ */
.loading-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px 0;
    color: var(--text-muted);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state h4 {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.empty-state p {
    font-size: 0.88rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .config-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: block;
    }

    .top-header {
        padding: 0 16px;
    }

    .content-section {
        padding: 20px 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-value {
        font-size: 1.4rem;
    }

    .stat-badge {
        display: none;
    }

    .filters-bar {
        flex-direction: column;
    }

    .search-box {
        min-width: unset;
    }

    .header-right .datetime {
        display: none;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .data-table {
        font-size: 0.82rem;
    }

    .data-table thead th,
    .data-table tbody td {
        padding: 10px 12px;
    }

    .data-table .juzgado-text {
        max-width: 140px;
    }

    .modal {
        max-height: 90vh;
        margin: 10px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .page-title h2 {
        font-size: 1.15rem;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }

    .timeline::before {
        left: 14px;
    }

    .timeline-dot {
        left: 10px;
    }
}

/* ============================================
   OVERLAY (for mobile sidebar)
   ============================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}