:root {
    color-scheme: light;
    --bg: #f5f7f6;
    --surface: #ffffff;
    --surface-alt: #eef5f3;
    --text: #1f2933;
    --muted: #61717d;
    --line: #d8e0dd;
    --primary: #0f766e;
    --primary-dark: #115e59;
    --accent: #b7791f;
    --danger: #b42318;
    --success: #157347;
    --shadow: 0 16px 35px rgba(31, 41, 51, 0.08);
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0b1416;
    --surface: #142124;
    --surface-alt: #1b2b2e;
    --text: #edf5f4;
    --muted: #a7bab7;
    --line: #35484a;
    --primary: #38bdb1;
    --primary-dark: #6ddbd1;
    --accent: #f2c46d;
    --danger: #ff8b82;
    --success: #65d89a;
    --shadow: 0 16px 35px rgba(0, 0, 0, 0.3);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    font-size: 16px;
}

a {
    color: var(--primary-dark);
    text-decoration: none;
    font-weight: 650;
}

a:hover {
    text-decoration: underline;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0.4rem;
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 1.05;
}

h2 {
    font-size: 1.15rem;
    margin-bottom: 0.9rem;
}

button,
input,
select {
    font: inherit;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    background: linear-gradient(180deg, #16312f 0%, #10403b 100%);
    color: #fff;
}

.sidebar-footer {
    margin: auto 0 0;
    padding-top: 1.5rem;
    color: #7fa39c;
    font-size: 0.78rem;
}

.sidebar-footer p {
    margin: 0.8rem 0 0;
}

.theme-selector-label {
    margin-bottom: 0.35rem;
    color: #b8cfca;
    font-size: 0.78rem;
}

.theme-selector {
    width: 100%;
    min-height: 38px;
    margin-bottom: 0.8rem;
    padding: 0.45rem 0.65rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: #163b38;
    color: #fff;
    cursor: pointer;
}

.user-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.55rem 0.7rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
}

.user-name {
    color: #e7f0ee;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logout-button {
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    background: transparent;
    color: #e7f0ee;
    padding: 0.25rem 0.6rem;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
}

.logout-button:hover {
    background: rgba(255, 255, 255, 0.14);
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: linear-gradient(160deg, #16312f 0%, #0f766e 100%);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.auth-brand {
    color: var(--text);
    margin-bottom: 1.5rem;
}

.auth-brand small {
    color: var(--muted);
}

.auth-title {
    font-size: 1.6rem;
    margin-bottom: 0.3rem;
}

.auth-theme-selector {
    grid-template-columns: auto 120px;
    align-items: center;
    justify-content: end;
    margin: -0.5rem 0 1rem;
}

.auth-theme-selector .input {
    min-height: 36px;
    padding: 0.35rem 0.55rem;
}

.auth-fields {
    display: grid;
    gap: 0.9rem;
    margin: 1.2rem 0;
}

.auth-submit {
    width: 100%;
}

.nav-icon {
    display: inline-block;
    width: 1.4rem;
    text-align: center;
    margin-right: 0.25rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: #fff;
    margin-bottom: 2rem;
}

.brand:hover {
    text-decoration: none;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    border-radius: 8px;
    background: #f7d46f;
    color: #16312f;
    font-weight: 800;
}

.brand small {
    display: block;
    margin-top: 0.1rem;
    color: #b8cfca;
}

.nav-toggle,
.nav-toggle-button {
    display: none;
}

.nav-menu {
    display: grid;
    gap: 0.35rem;
}

.nav-menu a {
    display: block;
    padding: 0.7rem 0.8rem;
    color: #e7f0ee;
    border-radius: 8px;
    font-weight: 650;
}

.nav-menu a:hover,
.nav-menu a.active {
    background: rgba(255, 255, 255, 0.12);
    text-decoration: none;
}

.main-content {
    min-width: 0;
    padding: 2rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.eyebrow {
    margin-bottom: 0.45rem;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.page-subtitle {
    color: var(--muted);
    max-width: 58rem;
}

.button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.65rem 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-weight: 750;
    white-space: nowrap;
}

.button:hover {
    text-decoration: none;
    border-color: var(--primary);
}

.button.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

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

.button:disabled {
    cursor: not-allowed;
    opacity: 0.62;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.metric-card,
.panel,
.content-band,
.empty-state {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.metric-card {
    padding: 1rem;
}

.metric-card span {
    display: block;
    color: var(--muted);
    font-size: 0.87rem;
    margin-bottom: 0.35rem;
}

.metric-card strong {
    font-size: 2rem;
    line-height: 1;
}

.split-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 0.85fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.panel,
.content-band,
.empty-state {
    padding: 1.1rem;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.8rem;
}

.section-title h2,
.section-title p {
    margin-bottom: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
    margin-bottom: 1rem;
}

.form-grid.three {
    grid-template-columns: minmax(220px, 1fr) 160px minmax(180px, 0.65fr);
}

label {
    display: grid;
    gap: 0.35rem;
    color: var(--muted);
    font-weight: 700;
}

.input,
input[type="file"] {
    min-height: 42px;
    width: 100%;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
}

.input:focus,
input[type="file"]:focus {
    outline: 3px solid rgba(15, 118, 110, 0.18);
    border-color: var(--primary);
}

.search-row,
.action-row {
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

.compact-stats {
    display: grid;
    gap: 0.75rem;
}

.compact-stats span {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid var(--line);
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

th,
td {
    padding: 0.72rem 0.8rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    background: var(--surface-alt);
    font-size: 0.78rem;
    text-transform: uppercase;
}

tbody tr:hover {
    background: var(--surface-alt);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: #e5f3f1;
    color: var(--primary-dark);
    font-size: 0.82rem;
    font-weight: 800;
    white-space: nowrap;
}

.status-pill.pill-info {
    background: #e3ecfb;
    color: #1d4ed8;
}

.status-pill.pill-success {
    background: #e2f3e9;
    color: var(--success);
}

.status-pill.pill-warn {
    background: #fbf0da;
    color: #92600a;
}

.status-pill.pill-danger {
    background: #fbe4e2;
    color: var(--danger);
}

.status-pill.pill-muted {
    background: #eceff1;
    color: #52616c;
}

.muted {
    color: var(--muted);
}

.success-message {
    margin: 0.9rem 0 0;
    color: var(--success);
    font-weight: 750;
}

.error-message {
    margin: 0.9rem 0 0;
    color: var(--danger);
    font-weight: 750;
}

.warning-list {
    margin: 0;
    padding-left: 1.2rem;
    color: #6f4e16;
}

.empty-state {
    padding: 2rem;
}

.validation-message {
    color: var(--danger);
    font-size: 0.86rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--success);
}

.invalid {
    outline: 1px solid var(--danger);
}

.blazor-error-boundary {
    background: #b32121;
    color: white;
    padding: 1rem;
}

#blazor-error-ui {
    color-scheme: light only;
    background: #fff8d7;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.button.small {
    min-height: 32px;
    padding: 0.3rem 0.65rem;
    font-size: 0.85rem;
}

.button.danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.button.danger:hover {
    background: #922015;
}

.button.danger-link {
    border-color: transparent;
    background: transparent;
    color: var(--danger);
}

.button.danger-link:hover {
    border-color: var(--danger);
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    white-space: nowrap;
}

.filter-row {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

.filter-row .input {
    min-width: 180px;
}

.status-select {
    min-height: 36px;
    width: auto;
    padding: 0.3rem 0.5rem;
    font-size: 0.88rem;
}

.passenger-filter .input {
    max-width: 320px;
}

.occupancy {
    height: 8px;
    margin-bottom: 0.9rem;
    border-radius: 999px;
    background: var(--surface-alt);
    overflow: hidden;
}

.occupancy-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--primary);
    transition: width 0.3s ease;
}

.occupancy-fill.over {
    background: var(--danger);
}

.bus-edit {
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px dashed var(--line);
    border-radius: 8px;
    background: var(--surface-alt);
}

.form-grid.four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.form-grid .span-2 {
    grid-column: span 2;
}

.birthday-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 0.45rem;
}

.birthday-list li {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.45rem 0.55rem;
    border-radius: 8px;
}

.birthday-list li.is-today {
    background: #fbf0da;
}

.birthday-day {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    border-radius: 8px;
    background: var(--surface-alt);
    color: var(--primary-dark);
    font-weight: 800;
}

.birthday-name {
    line-height: 1.25;
}

.birthday-name small {
    display: block;
    color: var(--muted);
}

.home-layout {
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    align-items: start;
}

.member-picker {
    margin: 0.9rem 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 0.4rem;
}

.member-picker li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.member-picker small {
    display: block;
}

.metric-card small {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.78rem;
}

tbody tr:nth-child(even) {
    background: color-mix(in srgb, var(--surface-alt) 45%, transparent);
}

:root[data-theme="dark"] .status-pill {
    background: #204340;
}

:root[data-theme="dark"] .status-pill.pill-info {
    background: #203b5a;
    color: #9ec7ff;
}

:root[data-theme="dark"] .status-pill.pill-success {
    background: #173f2b;
}

:root[data-theme="dark"] .status-pill.pill-warn,
:root[data-theme="dark"] .birthday-list li.is-today {
    background: #49391c;
    color: #ffd889;
}

:root[data-theme="dark"] .status-pill.pill-danger {
    background: #522925;
}

:root[data-theme="dark"] .status-pill.pill-muted {
    background: #313d40;
    color: var(--muted);
}

:root[data-theme="dark"] .warning-list {
    color: #f1c978;
}

:root[data-theme="dark"] .bus-frame-wrapper {
    background: #17272a;
    border-color: var(--line);
}

:root[data-theme="dark"] .bus-front-cabin {
    border-color: var(--line);
}

:root[data-theme="dark"] .bus-driver-area,
:root[data-theme="dark"] .unassigned-item {
    background: var(--surface-alt);
    color: var(--text);
}

:root[data-theme="dark"] .bus-door-area {
    color: var(--muted);
    border-color: var(--line);
}

:root[data-theme="dark"] .bus-seat.empty {
    background: #17334c;
    border-color: #4a8fc7;
    color: #b8dcff;
}

:root[data-theme="dark"] .bus-seat.empty:hover {
    background: #214766;
}

:root[data-theme="dark"] .unassigned-item.selected,
:root[data-theme="dark"] .seat-detail-card {
    background: #453719;
    color: #ffe5a9;
}

:root[data-theme="dark"] .seat-detail-header {
    border-color: #6e5724;
}

:root[data-theme="dark"] .seat-detail-header h4,
:root[data-theme="dark"] .seat-detail-body {
    color: #ffe5a9;
}

.detail-list {
    margin: 0;
    display: grid;
    gap: 0.65rem;
}

.detail-list div {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 0.6rem;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid var(--line);
}

.detail-list dt {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 700;
}

.detail-list dd {
    margin: 0;
}

.payment-detail-row > td {
    background: var(--surface-alt);
    padding: 1rem;
}

.inner-table {
    min-width: 0;
    margin-bottom: 0.9rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.inner-table th {
    font-size: 0.72rem;
}

.payment-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
}

.payment-form .input {
    width: auto;
    min-width: 130px;
}

.price-input {
    max-width: 160px;
}

.inline-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    white-space: nowrap;
}

.row-cancelled td {
    color: var(--muted);
    text-decoration: line-through;
}

.row-cancelled td .status-pill,
.row-cancelled td .button {
    text-decoration: none;
}

.print-only {
    display: none;
}

@media print {
    .sidebar,
    .no-print,
    #blazor-error-ui {
        display: none !important;
    }

    .print-only {
        display: inline-flex;
    }

    .app-shell {
        display: block;
    }

    .main-content {
        padding: 0;
    }

    body {
        background: #fff;
        font-size: 12px;
    }

    .metric-card,
    .panel,
    .content-band,
    .empty-state {
        box-shadow: none;
        break-inside: avoid;
    }

    .bus-band {
        page-break-inside: avoid;
    }

    table {
        min-width: 0;
    }

    a {
        text-decoration: none;
        color: inherit;
    }
}

@media (max-width: 960px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
    }

    .nav-menu {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .main-content {
        padding: 1rem;
    }

    .page-header,
    .search-row,
    .action-row {
        align-items: stretch;
        flex-direction: column;
    }

    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .split-layout,
    .home-layout,
    .form-grid,
    .form-grid.three,
    .form-grid.four {
        grid-template-columns: 1fr;
    }

    .form-grid .span-2 {
        grid-column: auto;
    }

    .filter-row {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .section-title {
        flex-wrap: wrap;
    }
}

/* ==========================================
   Estilos de Transiciones y Polish Visual Premium
   ========================================== */
.button,
.nav-menu a,
.metric-card,
.user-box,
.logout-button,
tbody tr,
.bus-seat {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.15);
}

.button:active {
    transform: translateY(0);
}

.nav-menu a:hover {
    padding-left: 1.1rem;
    background: rgba(255, 255, 255, 0.16);
}

.metric-card {
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 40px rgba(31, 41, 51, 0.12);
}

/* Bordes coloridos en metric-cards del Home/Tesoreria */
.metric-card:nth-child(1) { border-left: 4px solid var(--primary); }
.metric-card:nth-child(2) { border-left: 4px solid #4f46e5; }
.metric-card:nth-child(3) { border-left: 4px solid var(--accent); }
.metric-card:nth-child(4) { border-left: 4px solid var(--success); }

/* ==========================================
   Mapa de Asientos de Bus Interactivo
   ========================================== */
.bus-container {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(280px, 0.9fr);
    gap: 1.5rem;
    margin-top: 1.25rem;
    margin-bottom: 2rem;
}

.bus-frame-wrapper {
    background: #eef2f1;
    border: 2px solid #cbd5e1;
    border-radius: 20px 20px 8px 8px;
    padding: 1.5rem;
    position: relative;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
}

.bus-front-cabin {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #cbd5e1;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.bus-driver-area {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #475569;
    font-weight: 700;
    font-size: 0.85rem;
    background: #e2e8f0;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
}

.bus-door-area {
    color: #94a3b8;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 800;
    border: 1px dashed #cbd5e1;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
}

.bus-seats-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.6rem;
    row-gap: 0.9rem;
    align-items: center;
}

.bus-aisle {
    grid-column: 3;
    text-align: center;
    color: #94a3b8;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    user-select: none;
    pointer-events: none;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bus-seat {
    position: relative;
    aspect-ratio: 1 / 1;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.bus-seat.empty {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #1e3a8a;
}

.bus-seat.empty:hover {
    background: #dbeafe;
    border-color: #3b82f6;
    transform: scale(1.05);
}

.bus-seat.occupied {
    background: #0f766e;
    border-color: #0f766e;
    color: #ffffff;
    box-shadow: 0 4px 6px rgba(15, 118, 110, 0.2);
}

.bus-seat.occupied:hover {
    background: #115e59;
    transform: scale(1.05);
}

.bus-seat.highlighted {
    animation: pulse-glow 1.5s infinite alternate;
    border: 2px solid #d97706;
}

@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 5px rgba(217, 119, 6, 0.4);
    }
    100% {
        box-shadow: 0 0 15px rgba(217, 119, 6, 0.9);
    }
}

.bus-seat-num {
    font-size: 0.85rem;
    font-weight: 800;
}

.bus-seat-name {
    font-size: 0.62rem;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 0.2rem;
    font-weight: 600;
}

.bus-seat.occupied .bus-seat-name {
    color: #ccfbf1;
}

.bus-seat.empty .bus-seat-name {
    color: #60a5fa;
}

/* Panel de pasajeros sin asiento */
.unassigned-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1.2rem;
    box-shadow: var(--shadow);
}

.unassigned-list {
    margin: 0.8rem 0 0;
    padding: 0;
    list-style: none;
    max-height: 380px;
    overflow-y: auto;
    display: grid;
    gap: 0.4rem;
}

.unassigned-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    cursor: pointer;
    background: #fafafa;
}

.unassigned-item:hover {
    background: var(--surface-alt);
    border-color: var(--primary);
}

.unassigned-item.selected {
    background: #fef3c7;
    border-color: #d97706;
}

.unassigned-name {
    font-weight: 700;
    font-size: 0.82rem;
    line-height: 1.2;
}

.unassigned-club {
    font-size: 0.72rem;
    color: var(--muted);
}

/* Tooltip / Tarjeta emergente de detalles de asiento */
.seat-detail-card {
    margin-top: 1rem;
    background: #fffbeb;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.1);
}

.seat-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
    border-bottom: 1px solid #fef3c7;
    padding-bottom: 0.4rem;
}

.seat-detail-header h4 {
    margin: 0;
    color: #b45309;
    font-size: 0.95rem;
}

.seat-detail-body {
    font-size: 0.82rem;
    line-height: 1.4;
    color: #78350f;
}

.seat-detail-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.8rem;
}

/* ==========================================
   Tesorería General
   ========================================== */
.tesoreria-header-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1.5rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

.tesoreria-filters {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
    background: var(--surface);
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.tesoreria-filters .input {
    min-width: 200px;
}

/* Estilos de iconos SVG */
.nav-menu a {
    display: flex !important;
    align-items: center;
    gap: 0.75rem;
}

.nav-menu svg {
    width: 1.25rem;
    height: 1.25rem;
    stroke: currentColor;
    fill: none;
}

.brand svg {
    width: 1.5rem;
    height: 1.5rem;
    stroke: currentColor;
    fill: none;
}

/* Adaptación para tablet y móvil. Se mantiene al final para prevalecer
   sobre los estilos específicos de mapas de asientos y tesorería. */
@media (max-width: 960px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: sticky;
        top: 0;
        z-index: 100;
        height: auto;
        min-height: 68px;
        padding: 0.8rem 1rem;
        box-shadow: 0 4px 18px rgba(0, 0, 0, 0.2);
    }

    .brand {
        width: fit-content;
        margin: 0;
        padding-right: 3.5rem;
    }

    .brand-mark {
        width: 40px;
        height: 40px;
    }

    .nav-toggle {
        position: absolute;
        width: 1px;
        height: 1px;
        opacity: 0;
        pointer-events: none;
    }

    .nav-toggle-button {
        position: absolute;
        top: 0.85rem;
        right: 1rem;
        width: 42px;
        height: 42px;
        display: grid;
        place-content: center;
        gap: 5px;
        border: 1px solid rgba(255, 255, 255, 0.35);
        border-radius: 8px;
        cursor: pointer;
    }

    .nav-toggle-button span {
        width: 21px;
        height: 2px;
        border-radius: 999px;
        background: #fff;
        transition: transform 0.2s ease, opacity 0.2s ease;
    }

    .nav-toggle:focus-visible + .nav-toggle-button {
        outline: 3px solid #f7d46f;
        outline-offset: 2px;
    }

    .nav-toggle:checked + .nav-toggle-button span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .nav-toggle:checked + .nav-toggle-button span:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle:checked + .nav-toggle-button span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .sidebar .nav-menu,
    .sidebar .sidebar-footer {
        display: none;
    }

    .nav-toggle:checked ~ .nav-menu {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        margin-top: 1rem;
        padding-top: 0.8rem;
        border-top: 1px solid rgba(255, 255, 255, 0.14);
    }

    .nav-toggle:checked ~ .sidebar-footer {
        display: grid;
        grid-template-columns: minmax(130px, 220px) minmax(160px, 1fr);
        align-items: end;
        gap: 0.5rem 1rem;
        margin: 0;
        padding-top: 1rem;
    }

    .sidebar-footer p {
        display: none;
    }

    .theme-selector,
    .user-box {
        margin-bottom: 0;
    }

    .main-content {
        width: 100%;
        padding: 1.25rem;
    }

    .page-header,
    .search-row,
    .action-row {
        align-items: stretch;
        flex-direction: column;
    }

    .split-layout,
    .home-layout,
    .form-grid,
    .form-grid.three,
    .form-grid.four,
    .bus-container,
    .tesoreria-header-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .form-grid .span-2 {
        grid-column: auto;
    }

    .filter-row,
    .tesoreria-filters {
        align-items: stretch;
        flex-direction: column;
        width: 100%;
    }

    .filter-row .input,
    .tesoreria-filters .input {
        min-width: 0;
        width: 100%;
    }

    .section-title {
        flex-wrap: wrap;
    }

    .bus-container {
        gap: 1rem;
    }
}

@media (max-width: 640px) {
    body {
        font-size: 15px;
    }

    h1 {
        font-size: clamp(1.75rem, 9vw, 2.35rem);
    }

    .brand small {
        display: none;
    }

    .nav-toggle:checked ~ .nav-menu,
    .nav-toggle:checked ~ .sidebar-footer {
        grid-template-columns: minmax(0, 1fr);
    }

    .nav-menu a:hover {
        padding-left: 0.8rem;
    }

    .main-content {
        padding: 0.85rem;
    }

    .page-header {
        gap: 0.8rem;
        margin-bottom: 1rem;
    }

    .panel,
    .content-band,
    .empty-state,
    .metric-card,
    .unassigned-panel {
        padding: 0.85rem;
    }

    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.65rem;
    }

    .metric-card strong {
        font-size: 1.6rem;
    }

    .button,
    .page-header > .button,
    .page-header > a.button,
    .search-row .button,
    .action-row .button {
        width: 100%;
    }

    .row-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        white-space: normal;
    }

    .row-actions .button {
        width: 100%;
    }

    .table-wrap {
        max-width: 100%;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 620px;
    }

    th,
    td {
        padding: 0.62rem 0.65rem;
    }

    .detail-list div {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.2rem;
    }

    .member-picker li,
    .unassigned-item,
    .seat-detail-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .payment-form,
    .inline-label {
        align-items: stretch;
        flex-direction: column;
        white-space: normal;
    }

    .payment-form .input,
    .price-input,
    .status-select,
    .passenger-filter .input {
        width: 100%;
        max-width: none;
    }

    .bus-frame-wrapper {
        padding: 0.8rem;
        border-radius: 14px 14px 8px 8px;
    }

    .bus-front-cabin {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.6rem;
    }

    .bus-seats-grid {
        gap: 0.3rem;
        row-gap: 0.55rem;
    }

    .bus-seat {
        min-width: 0;
        padding: 0.2rem;
    }

    .bus-seat-name {
        font-size: 0.55rem;
    }

    .auth-shell {
        padding: 0.75rem;
    }

    .auth-card {
        padding: 1.15rem;
    }

    .auth-theme-selector {
        grid-template-columns: minmax(0, 1fr);
        justify-content: stretch;
    }
}

@media (max-width: 420px) {
    .metric-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .row-actions {
        grid-template-columns: minmax(0, 1fr);
    }
}

.table-sort-button {
    width: 100%;
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    text-align: left;
    text-transform: inherit;
}

.table-sort-button:hover {
    color: var(--primary-dark);
}

.table-sort-button:focus-visible {
    border-radius: 4px;
    outline: 3px solid color-mix(in srgb, var(--primary) 35%, transparent);
    outline-offset: 2px;
}

.sort-indicator {
    width: 0;
    height: 0;
    flex: 0 0 auto;
    border-right: 4px solid transparent;
    border-left: 4px solid transparent;
    opacity: 0.45;
}

.table-sort-button[data-direction="none"] .sort-indicator {
    border-top: 5px solid currentColor;
    border-bottom: 5px solid currentColor;
}

.table-sort-button[data-direction="asc"] .sort-indicator {
    border-bottom: 7px solid currentColor;
}

.table-sort-button[data-direction="desc"] .sort-indicator {
    border-top: 7px solid currentColor;
}

.person-search-panel {
    margin-bottom: 1.25rem;
}

.home-dashboard {
    display: flex;
    flex-direction: column;
}

.home-dashboard > .page-header {
    order: 1;
}

.home-dashboard > .person-search-panel {
    order: 2;
}

.home-dashboard > .metric-grid {
    order: 3;
}

.home-dashboard > .home-layout {
    order: 4;
}

.payment-detail-card {
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
}

.person-search-results {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}

.person-result-card {
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-alt);
}

.person-result-header,
.person-trip-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
}

.person-result-header h3,
.person-trip-card p {
    margin-bottom: 0;
}

.person-result-sections {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.person-trip-list {
    display: grid;
    gap: 0.55rem;
}

.person-trip-card {
    padding: 0.7rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.person-trip-card small {
    display: block;
    margin-top: 0.15rem;
    color: var(--muted);
}

@media screen and (max-width: 640px) {
    .table-wrap {
        overflow: visible;
    }

    table.responsive-table {
        display: block;
        min-width: 0;
        background: transparent;
        border: 0;
    }

    table.responsive-table > thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        white-space: nowrap;
    }

    table.responsive-table > tbody {
        display: grid;
        gap: 0.8rem;
        width: 100%;
    }

    table.responsive-table > tbody > tr:not(.payment-detail-row) {
        display: block;
        width: 100%;
        padding: 0.45rem 0.75rem;
        border: 1px solid var(--line);
        border-radius: 10px;
        background: var(--surface);
        box-shadow: var(--shadow);
    }

    table.responsive-table > tbody > tr:not(.payment-detail-row):hover {
        background: var(--surface);
    }

    table.responsive-table > tbody > tr:not(.payment-detail-row) > td {
        width: 100%;
        min-height: 38px;
        display: grid;
        grid-template-columns: minmax(105px, 38%) minmax(0, 1fr);
        align-items: center;
        gap: 0.75rem;
        padding: 0.55rem 0;
        border-bottom: 1px solid var(--line);
        overflow-wrap: anywhere;
    }

    table.responsive-table > tbody > tr:not(.payment-detail-row) > td:last-child {
        border-bottom: 0;
    }

    table.responsive-table > tbody > tr:not(.payment-detail-row) > td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 0.76rem;
        font-weight: 800;
        letter-spacing: 0.02em;
        text-transform: uppercase;
    }

    table.responsive-table > tbody > .payment-detail-row {
        display: block;
        margin-top: -0.8rem;
    }

    table.responsive-table > tbody > .payment-detail-row > td {
        display: block;
        width: 100%;
        padding: 0.85rem;
        border: 1px solid var(--line);
        border-top: 0;
        border-radius: 0 0 10px 10px;
    }

    table.responsive-table > tbody > .payment-detail-row > td::before {
        content: none;
    }

    .person-result-sections {
        grid-template-columns: minmax(0, 1fr);
    }

    .person-result-header,
    .person-trip-card {
        align-items: stretch;
        flex-direction: column;
    }

    .person-trip-card .button {
        width: 100%;
    }
}

.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-bottom: 0.75rem;
    padding: 0.65rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-alt);
}

.table-export-actions,
.table-pagination-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.table-pagination-controls label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.table-page-size {
    width: auto;
    min-width: 82px;
    min-height: 34px;
    padding: 0.3rem 0.45rem;
}

.table-page-info {
    min-width: 150px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
    text-align: center;
}

.responsive-table tr[hidden] {
    display: none !important;
}

.bulk-action-confirmation {
    margin-bottom: 1.25rem;
    border-color: var(--accent);
}

@media screen and (max-width: 640px) {
    .table-toolbar,
    .table-export-actions,
    .table-pagination-controls {
        align-items: stretch;
        flex-direction: column;
    }

    .table-toolbar .button,
    .table-toolbar label,
    .table-page-size {
        width: 100%;
    }

    .table-pagination-controls label {
        align-items: stretch;
        flex-direction: column;
    }

    .table-page-info {
        min-width: 0;
        padding: 0.3rem;
    }
}
