/* Viajario 0.13.6 · cabecera móvil, presupuesto cerrable y archivo de viajes */

/* El logotipo conserva siempre su extremo derecho dentro de la cabecera. */
.topbar .brand {
    min-width: 0;
    max-width: 190px;
    display: flex;
    align-items: center;
    padding-right: 6px;
    overflow: visible;
}

.topbar .brand img {
    display: block;
    max-width: 100%;
    object-fit: contain;
    object-position: left center;
    clip-path: none;
}

/* Editor de presupuesto como ventana inequívoca y cerrable. */
.budget-settings[open] {
    position: fixed;
    z-index: 12000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(3, 13, 48, .72);
}

.budget-settings[open] > summary { display: none; }

.budget-settings[open] .popover-form {
    position: relative;
    z-index: 1;
    inset: auto;
    width: min(560px, 100%);
    max-height: calc(100dvh - 36px);
    margin: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.budget-editor-header {
    margin: -4px 0 18px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.budget-editor-header h3 { margin: 3px 0 0; }

.budget-editor-close {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    padding: 0;
    color: #061857;
    background: #eef1f7;
    border: 1px solid #d8deea;
    border-radius: 7px;
    font-size: 30px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
}

.budget-editor-close:hover,
.budget-editor-close:focus-visible {
    color: #fff;
    background: #eb6255;
    border-color: #eb6255;
}

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

/* Tarjetas con acciones externas al enlace principal. */
.trip-card {
    position: relative;
    overflow: hidden;
}

.trip-card-link {
    min-height: 100%;
    display: block;
    padding: inherit;
    color: inherit;
    text-decoration: none;
}

.trip-card:has(.trip-card-link) { padding: 0; }
.trip-card:has(.trip-card-link) .trip-card-link { padding: 22px; }

.current-trip-card {
    border: 2px solid #eb6255;
    box-shadow: 0 18px 44px rgba(6, 24, 87, .16);
}

.current-trip-card .trip-card-link {
    padding: clamp(24px, 4vw, 38px);
    background: linear-gradient(135deg, rgba(235, 98, 85, .08), #fff 48%);
}

.current-trip-card h3 {
    font-size: clamp(28px, 4vw, 42px);
}

.secondary-trip-grid { opacity: .94; }

.trip-archive-action {
    padding: 0 22px 18px;
    text-align: right;
}

.trip-archive-action button {
    padding: 7px 10px;
    color: #536079;
    background: transparent;
    border: 1px solid #d8deea;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 750;
    cursor: pointer;
}

.trip-archive-action button:hover,
.trip-archive-action button:focus-visible {
    color: #061857;
    background: #f1f3f8;
}

.compact-heading { margin-top: 34px; }

.archived-trips-panel {
    margin-top: 34px;
    border: 1px solid #dce2ec;
    border-radius: 7px;
    background: rgba(255, 255, 255, .72);
}

.archived-trips-panel > summary {
    min-height: 66px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 18px;
    list-style: none;
    cursor: pointer;
}

.archived-trips-panel > summary::-webkit-details-marker { display: none; }
.archived-trips-panel > summary span { display: grid; gap: 3px; }
.archived-trips-panel > summary small { color: #69738f; }
.archived-trips-panel > summary b { color: #17377c; font-size: 13px; }
.archived-trips-panel[open] > summary { border-bottom: 1px solid #dce2ec; }

.archived-trip-grid {
    padding: 18px;
}

.archived-trip-card {
    opacity: .82;
    box-shadow: none;
}

.status.archived,
.status.finished {
    color: #5f6879;
    background: #edf0f4;
}

.compact-empty { margin-top: 18px; }

@media (max-width: 760px) {
    .topbar .brand {
        max-width: min(148px, calc(100vw - 162px));
        padding-right: 8px;
        flex: 0 1 auto;
    }

    .topbar .brand img {
        width: auto;
        max-width: 100%;
        height: 38px;
    }

    .budget-settings[open] {
        align-items: end;
        padding: 8px;
    }

    .budget-settings[open] .popover-form {
        width: 100%;
        max-height: calc(100dvh - 16px);
    }

    .budget-editor-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .budget-editor-actions .button { width: 100%; }
    .trip-card:has(.trip-card-link) .trip-card-link { padding: 18px; }
    .current-trip-card .trip-card-link { padding: 24px 20px; }
    .trip-archive-action { padding: 0 18px 16px; }
    .archived-trip-grid { padding: 12px; }
}
