:root {
    --primary: #c25934;
    --primary-dark: #a14728;
    --primary-light: #fef2ee;
    --bg-color: #f4f4f9;
    --bg-card: #ffffff;
    --text-main: #333333;
    --text-muted: #666666;
    --border-color: #eaeaea;
    --font-sans: 'Inter', system-ui, sans-serif;
}
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
}
.topbar {
    background-color: var(--bg-card);
    padding: 15px 30px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid var(--border-color);
}
.logo-box {
    background-color: var(--primary);
    width: 45px;
    height: 45px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
}
.logo-box svg {
    width: 24px;
    height: 24px;
    fill: white;
}
.title-group h1 {
    font-size: 1.4rem;
    color: #1a1a1a;
    margin-bottom: 2px;
}
.title-group p {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.app-container {
    max-width: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.app-header h1 {
    font-family: var(--font-sans);
    color: var(--primary);
    font-size: 2.2rem;
}
.app-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}
h2 {
    font-family: var(--font-sans);
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: #202124;
}
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
.card-header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.card-header-info svg {
    width: 20px;
    height: 20px;
    color: var(--primary);
}
.card-header-info h2 {
    font-size: 1.3rem;
    color: #1a1a1a;
    margin-bottom: 0px;
}
.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s ease;
    border: none;
    font-family: var(--font-sans);
}
.btn-primary {
    background-color: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background-color: var(--primary-dark);
}
.btn-secondary {
    background-color: #fff;
    border: 1px solid var(--border-color);
    color: #333;
}
.btn-secondary:hover {
    background-color: #f9f9f9;
    border-color: #ccc;
}
.table-responsive {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}
th {
    background: #f3f4f6;
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: left;
    padding: 12px;
    color: #555;
}
td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}
.person-cell {
    font-weight: 500;
}
.person-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}
select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
select:hover,
select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px var(--primary-light);
}
details summary {
    font-weight: 600;
    cursor: pointer;
    padding: 10px 0;
    color: var(--text-main);
    list-style: none;
}
details summary::-webkit-details-marker {
    display: none;
}
details summary::before {
    content: '▶';
    margin-right: 10px;
    font-size: 0.8em;
    color: var(--primary);
    display: inline-block;
    transition: 0.2s;
}
details[open] summary::before {
    transform: rotate(90deg);
}
.legend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
    margin-top: 15px;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid transparent;
}
.badge-blue {
    background: #e0f2fe;
    color: #0369a1;
}
.badge-orange {
    background: #ffedd5;
    color: #c2410c;
}
.badge-green {
    background: #dcfce7;
    color: #15803d;
}
.badge-purple {
    background: #f3e8ff;
    color: #7e22ce;
}
.badge-dark {
    background: #2a2a2a;
    color: #ffffff;
}
.summary-container {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
}
.summary-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.summary-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.stat-pill {
    background: #f4f4f9;
    border: 1px solid #ddd;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 500;
}
.day-block {
    margin-bottom: 30px;
}
.day-header {
    background: #202124;
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.day-header h3 {
    font-family: var(--font-sans);
    margin: 0;
    font-size: 1.3rem;
    color: #fff;
}
.day-meta {
    display: flex;
    gap: 10px;
}
.day-meta .badge {
    background: #3c4043;
    color: #e8eaed;
    border: none;
}
.cars-container {
    padding: 15px;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    background: #fafafa;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 15px;
}
.car-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}
.car-header {
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
}
.car-title {
    font-weight: 600;
    color: #444;
    font-size: 0.9rem;
    text-transform: uppercase;
}
.car-occupancy {
    border: 1px solid var(--primary-light);
    color: var(--primary-dark);
    background: #fff;
}
.journey-row {
    padding: 12px 15px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}
.journey-row:last-child {
    border-bottom: none;
}
.journey-label {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}
.label-departure {
    background: #fee2e2;
    color: #b91c1c;
}
.label-return {
    background: #e0f2fe;
    color: #0369a1;
}
.journey-time {
    font-size: 0.9rem;
    font-weight: 600;
    color: #555;
    margin-top: 1px;
    width: 45px;
}
.journey-people {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.pill-driver {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
}
.pill-passenger {
    background: #fff;
    border: 1px solid var(--primary-light);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--primary-dark);
}
.empty-state {
    font-size: 0.85rem;
    color: #9ca3af;
    font-style: italic;
    margin-top: 4px;
}
@media (max-width: 768px) {
    table {
        min-width: 100%;
        width: 100%;
    }
    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block;
    }
    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    tr {
        margin-bottom: 15px;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        background: #fff;
    }
    td {
        border: none;
        border-bottom: 1px solid #eee;
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 15px;
    }
    td:last-child {
        border-bottom: 0;
    }
    td::before {
        position: static;
        width: auto;
        font-size: 0.8rem;
        font-weight: 600;
        color: #666;
        text-transform: uppercase;
    }
    td:nth-of-type(1)::before {
        content: 'Persona';
    }
    td:nth-of-type(2)::before {
        content: 'Lunes';
    }
    td:nth-of-type(3)::before {
        content: 'Martes';
    }
    td:nth-of-type(4)::before {
        content: 'Miércoles';
    }
    td:nth-of-type(5)::before {
        content: 'Jueves';
    }
    td:nth-of-type(6)::before {
        content: 'Viernes';
    }
    td:nth-of-type(1) {
        flex-direction: row;
        align-items: center;
        background: #fafafa;
        border-radius: 8px 8px 0 0;
    }
    td:nth-of-type(1)::before {
        display: none;
    }
    .cars-container {
        grid-template-columns: 1fr;
    }
    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        margin-top: 5px;
    }
    .actions .btn {
        width: 100%;
        text-align: center;
        justify-content: center;
        padding: 10px;
    }
    #btn-generate {
        grid-column: 1 / -1;
    }
}
@media print {
    body {
        background: #fff;
        padding: 0;
    }
    .screen-only,
    .app-header {
        display: none !important;
    }
    .app-container {
        max-width: 100%;
        gap: 0;
        display: block;
    }
    .card {
        border: none;
        box-shadow: none;
        padding: 0;
    }
    .day-block {
        page-break-inside: avoid;
        margin-bottom: 20px;
    }
    .cars-container {
        grid-template-columns: repeat(2, 1fr);
        border: none;
        padding: 0;
        margin-top: 10px;
    }
    .car-card {
        border: 1px solid #000;
        break-inside: avoid;
    }
    .day-header {
        background: #fff;
        color: #000;
        border-bottom: 2px solid #000;
        padding: 5px 0;
    }
    .day-header h3,
    .day-meta .badge {
        color: #000;
        background: transparent;
    }
    .pill-driver,
    .pill-passenger {
        border: 1px solid #000;
        color: #000;
    }
    .label-departure,
    .label-return {
        border: 1px solid #000;
        background: #fff;
        color: #000;
    }
}
