:root {
    --primary: #2e7d32;
    --primary-dark: #1b5e20;
    --accent: #D4A574;
    --text: #333;
    --text-light: #666;
    --white: #fff;
    --bg: #f5f5f5;
    --border: #ddd;
    --danger: #c62828;
}

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

body {
    font-family: 'Sora', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    overflow-x: hidden;
}

.ruta-container {
    max-width: min(1600px, 96vw);
    margin: 0 auto;
    padding: 0 16px 40px;
}

.ruta-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: 20px 16px;
    margin: 0 -16px 24px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    max-width: min(1600px, 96vw);
    margin: 0 auto;
}

.ruta-header h1 {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    overflow-wrap: anywhere;
}

.header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    transition: transform 0.2s, background 0.2s;
}

.btn:hover { transform: translateY(-1px); }

.btn-refresh {
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary-dark);
}

.btn-refresh:hover { background: var(--white); }

.btn-back {
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
}

.btn-back:hover { background: rgba(255, 255, 255, 0.3); }

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--white);
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.stat-icon--today { background: #1565c0; }
.stat-icon--cobrador { background: var(--accent); }

.stat-info h3 {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.1;
}

.stat-info p {
    font-size: 12px;
    color: var(--text-light);
}

.filters-section {
    background: var(--white);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.filters-section h2 {
    font-size: 1.1rem;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    align-items: end;
}

.filter-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}

.btn-clear {
    width: 100%;
    padding: 10px 14px;
    background: #f5f5f5;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-clear:hover { background: #eee; }

.loading,
.empty-state,
.error-box {
    text-align: center;
    padding: 40px 20px;
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    color: var(--text-light);
}

.empty-state i,
.error-box i {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
}

.error-box {
    color: var(--danger);
    border: 1px solid #ffcdd2;
    background: #ffebee;
}

.hidden { display: none !important; }

.table-section {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.table-wrap { overflow-x: auto; }

.ruta-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.ruta-table th,
.ruta-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid #eee;
    vertical-align: top;
}

.ruta-table th {
    background: #f8f8f8;
    font-weight: 600;
    white-space: nowrap;
}

.ruta-table tbody tr:hover { background: #fafafa; }

.qr-cell {
    font-family: Consolas, 'Courier New', monospace;
    font-size: 13px;
    word-break: break-all;
    max-width: 220px;
}

.coords-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

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

.coords-muted {
    color: var(--text-light);
    font-size: 12px;
}

.badge-prueba {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    background: #fff3e0;
    color: #e65100;
}

.comprobante-cell {
    min-width: 140px;
    max-width: 200px;
}

.comprobante-sin {
    color: var(--text-light);
    font-size: 13px;
}

.comprobante-atraso {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #c62828;
    font-size: 13px;
    font-weight: 600;
}

.comprobante-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #c62828;
    font-weight: 600;
    text-decoration: none;
    font-size: 13px;
}

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

.comprobante-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}

.comprobante-estado {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.comprobante-estado--pagado { background: #e8f5e9; color: #2e7d32; }
.comprobante-estado--pendiente { background: #fff8e1; color: #f57f17; }
.comprobante-estado--parcial { background: #e3f2fd; color: #1565c0; }
.comprobante-estado--adelantado { background: #f3e5f5; color: #7b1fa2; }
.comprobante-estado--atrasado { background: #ffebee; color: #c62828; }
.comprobante-estado--otro { background: #f5f5f5; color: #616161; }

.comprobante-monto {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
}

.table-footer {
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-light);
    border-top: 1px solid #eee;
}

@media (max-width: 768px) {
    .ruta-container { padding: 0 12px 40px; }
    .ruta-header { margin: 0 -12px 20px; }
    .header-content { flex-direction: column; align-items: stretch; }
    .ruta-header h1 { font-size: 1.2rem; }
    .header-actions { width: 100%; }
    .header-actions .btn { flex: 1 1 calc(50% - 8px); justify-content: center; }
    .stats-row { grid-template-columns: 1fr 1fr; }
    .filters-grid { grid-template-columns: 1fr; }
    .filters-section { padding: 16px; }
    .ruta-table { min-width: 880px; }
}

@media (max-width: 480px) {
    .ruta-header h1 { font-size: 1.05rem; }
    .header-actions .btn { flex-basis: 100%; }
    .stats-row { grid-template-columns: 1fr; }
}
