/* Waystead: layout and components.
   Colours come from the MudBlazor theme variables so light and dark both work.
   The look: photo-led, rounded, soft shadows, one colour per kind of booking. */

:root {
    --flight: #2f80ed;
    --lodging: #8e5cf7;
    --car: #f2994a;
    --rail: #12b5a5;
    --activity: #e64c8d;
    --dining: #eb5757;
    --other: #6b7a80;

    --radius: 20px;
    --radius-small: 14px;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 6px 20px rgba(16, 24, 40, 0.08);
    --shadow-lift: 0 2px 6px rgba(16, 24, 40, 0.1), 0 14px 32px rgba(16, 24, 40, 0.16);
    --nav-height: 68px;
}

.type-flight { --type: var(--flight); }
.type-lodging { --type: var(--lodging); }
.type-car { --type: var(--car); }
.type-rail { --type: var(--rail); }
.type-activity { --type: var(--activity); }
.type-dining { --type: var(--dining); }
.type-other { --type: var(--other); }

html, body {
    height: 100%;
    margin: 0;
    background: var(--mud-palette-background, #f7f4ee);
    overscroll-behavior-y: none;
}

/* No web font is downloaded: use whatever the phone's own interface uses. */
body, body * {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
}

body pre, body code {
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace !important;
}

/* Quieter supporting text. (MudBlazor's Color.Secondary is the accent colour, not this.) */
.muted {
    color: var(--mud-palette-text-secondary) !important;
}

/* ---------- MudBlazor, softened ---------- */

.mud-button-root {
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-weight: 600 !important;
}

.mud-button-root.mud-button {
    border-radius: 999px !important;
    padding-left: 18px;
    padding-right: 18px;
}

.mud-button-filled {
    box-shadow: none !important;
}

.mud-dialog {
    border-radius: 24px !important;
}

.mud-dialog .mud-dialog-title {
    padding-top: 20px;
}

.mud-dialog .mud-dialog-title .mud-typography {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.mud-input-outlined-border {
    border-radius: var(--radius-small) !important;
}

.mud-paper-outlined {
    border-radius: var(--radius) !important;
    border-color: transparent !important;
    box-shadow: var(--shadow);
}

.mud-popover .mud-list {
    padding: 6px;
}

.mud-popover {
    border-radius: 18px !important;
}

.mud-alert {
    border-radius: var(--radius-small) !important;
}

.mud-snackbar {
    border-radius: 999px !important;
    margin-bottom: calc(var(--nav-height) + 12px);
}

/* ---------- App frame ---------- */

.app {
    display: flex;
    flex-direction: column;
    height: 100dvh;
}

.app-main {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.bottom-nav {
    display: flex;
    gap: 2px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: var(--mud-palette-surface);
    box-shadow: 0 -1px 0 var(--mud-palette-lines-default);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 2px 0;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--mud-palette-text-secondary);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

/* The active tab's icon sits in a tinted pill. */
.bottom-nav-item > .mud-icon-root,
.bottom-nav-item > .mud-badge-root {
    padding: 4px 18px;
    border-radius: 999px;
    transition: background-color 0.15s;
    box-sizing: content-box;
}

.bottom-nav-item.active {
    color: var(--mud-palette-primary);
    font-weight: 700;
}

.bottom-nav-item.active > .mud-icon-root,
.bottom-nav-item.active > .mud-badge-root {
    background: var(--mud-palette-primary-hover);
}

/* ---------- List and detail ---------- */

/* Narrow: one pane at a time. */
.split {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    height: 100%;
}

.split-list, .split-detail, .page {
    position: relative;
    min-height: 0;
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.split-detail {
    display: none;
}

.split.has-selection .split-list {
    display: none;
}

.split.has-selection .split-detail {
    display: block;
}

/* Wide, such as an unfolded phone or a tablet: list and detail side by side. */
@media (min-width: 840px) {
    .split {
        grid-template-columns: 400px minmax(0, 1fr);
    }

    .split-list, .split.has-selection .split-list {
        display: block;
        border-right: 1px solid var(--mud-palette-lines-default);
    }

    .split-detail {
        display: block;
    }

    .back-button {
        display: none !important;
    }
}

.page {
    max-width: 720px;
    margin: 0 auto;
}

.pane-header {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: calc(18px + env(safe-area-inset-top)) 18px 10px;
    background: var(--mud-palette-background);
}

.pane-header .mud-typography-h5,
.pane-header .mud-typography-h4 {
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.pane-title {
    min-width: 0;
}

.pane-title .mud-typography {
    overflow-wrap: anywhere;
}

.pane-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 720px;
    padding: 0 18px 120px;
}

.section-label {
    margin: 14px 2px 0;
    font-size: 0.78rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.08em !important;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
}

.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 64px 28px;
    text-align: center;
    color: var(--mud-palette-text-secondary);
}

.empty .mud-icon-root {
    width: 72px;
    height: 72px;
    padding: 16px;
    border-radius: 50%;
    color: var(--mud-palette-primary);
    background: var(--mud-palette-primary-hover);
}

.empty .mud-typography-h6 {
    font-weight: 800;
    color: var(--mud-palette-text-primary);
}

/* Round buttons: the "+" on a list, and the controls laid over a photo. */
.round-button {
    flex: none;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.round-button.primary {
    color: var(--mud-palette-primary-text);
    background: var(--mud-palette-primary);
    box-shadow: var(--shadow);
}

.round-button.glass {
    color: #fff;
    background: rgba(0, 0, 0, 0.38);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.fab {
    position: fixed !important;
    right: 18px;
    bottom: calc(var(--nav-height) + 18px + env(safe-area-inset-bottom));
    z-index: 5;
    box-shadow: var(--shadow-lift) !important;
}

/* ---------- Sign in ---------- */

.centered {
    display: grid;
    place-items: center;
    gap: 16px;
    min-height: 100dvh;
    padding: 16px;
}

.login-page {
    background:
        radial-gradient(900px 500px at 15% -10%, rgba(31, 111, 120, 0.35), transparent 60%),
        radial-gradient(700px 500px at 110% 110%, rgba(240, 122, 92, 0.3), transparent 60%),
        var(--mud-palette-background);
}

.login-card {
    width: min(100%, 400px);
    border-radius: 28px !important;
    box-shadow: var(--shadow-lift) !important;
}

.login-mark {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.login-card .mud-typography-h4 {
    font-weight: 800;
    letter-spacing: -0.02em;
}

/* ---------- Photos and their fallbacks ---------- */

/* When a trip has no photo, a gradient chosen by its name stands in. */
.tint-0 { --tint: linear-gradient(135deg, #1f6f78, #58b7a7); }
.tint-1 { --tint: linear-gradient(135deg, #3a4f9c, #7fa6e8); }
.tint-2 { --tint: linear-gradient(135deg, #b8532f, #f0a05a); }
.tint-3 { --tint: linear-gradient(135deg, #6b3fa0, #c08adf); }
.tint-4 { --tint: linear-gradient(135deg, #2d6a4f, #95c66b); }

/* ---------- Trip cards ---------- */

.trip-card {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: var(--radius);
    color: #fff;
    text-decoration: none;
    box-shadow: var(--shadow);
    isolation: isolate;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s, box-shadow 0.15s;
}

.trip-card:active {
    transform: scale(0.985);
}

.trip-card-media {
    position: relative;
    aspect-ratio: 16 / 8;
    background: var(--tint);
}

.trip-card.featured .trip-card-media {
    aspect-ratio: 4 / 3.1;
}

.trip-card-media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.trip-card-glyph {
    position: absolute;
    right: 14px;
    top: 4px;
    font-size: 84px;
    line-height: 1;
    opacity: 0.22;
}

/* Darkens the bottom of the photo so white text reads on any picture. */
.trip-card-shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.28) 45%, rgba(0, 0, 0, 0) 70%);
}

.trip-card-text {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.trip-card-name {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1.15;
    overflow-wrap: anywhere;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}

.trip-card.featured .trip-card-name {
    font-size: 1.85rem;
}

.trip-card-dates {
    font-size: 0.9rem;
    opacity: 0.92;
}

.trip-card .countdown {
    position: absolute;
    top: 12px;
    left: 12px;
}

/* "This is the one shown beside the list" only means something when there is a beside. */
@media (min-width: 840px) {
    .trip-card.selected, .review-card.selected {
        box-shadow: 0 0 0 3px var(--mud-palette-primary), var(--shadow);
    }
}

/* Past trips: a small thumbnail beside the text. */
.trip-card.compact {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    color: var(--mud-palette-text-primary);
    background: var(--mud-palette-surface);
}

.trip-card.compact .trip-card-media {
    flex: none;
    width: 64px;
    aspect-ratio: 1;
    border-radius: 14px;
    overflow: hidden;
}

.trip-card.compact .trip-card-glyph {
    position: static;
    display: grid;
    place-items: center;
    height: 100%;
    font-size: 26px;
    opacity: 0.6;
}

.trip-card.compact .trip-card-text {
    position: static;
    flex: 1;
    min-width: 0;
}

.trip-card.compact .trip-card-name {
    font-size: 1.05rem;
    text-shadow: none;
}

.trip-card.compact .trip-card-dates {
    color: var(--mud-palette-text-secondary);
}

.countdown {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 700;
    color: #17303a;
    background: rgba(255, 255, 255, 0.92);
    white-space: nowrap;
}

/* ---------- Trip header ---------- */

.trip-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 250px;
    color: #fff;
    background: var(--tint);
    isolation: isolate;
}

@media (min-width: 840px) {
    .trip-hero {
        min-height: 300px;
        margin: 14px 18px 0;
        border-radius: 28px;
        overflow: hidden;
    }
}

.trip-hero-img {
    position: absolute;
    inset: 0;
    z-index: -2;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.trip-hero-shade {
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.15) 55%, rgba(0, 0, 0, 0.3) 100%);
}

.trip-hero-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: calc(12px + env(safe-area-inset-top)) 14px 0;
}

.trip-hero-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 0 18px 18px;
}

.trip-hero-text h1 {
    margin: 0;
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
    overflow-wrap: anywhere;
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.4);
}

.trip-hero-text p {
    margin: 0;
    font-size: 1rem;
    opacity: 0.95;
}

/* The facts under the photo: days, flights, nights, places. */
.stat-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 14px 18px 4px;
    scrollbar-width: none;
}

.stat-row::-webkit-scrollbar {
    display: none;
}

.stat {
    flex: none;
    display: flex;
    flex-direction: column;
    min-width: 76px;
    padding: 10px 14px;
    border-radius: 18px;
    background: var(--mud-palette-surface);
    box-shadow: var(--shadow);
}

.stat b {
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.1;
}

.stat span {
    font-size: 0.78rem;
    color: var(--mud-palette-text-secondary);
}

/* ---------- Tabs on a trip ---------- */

.tab-bar {
    display: flex;
    gap: 4px;
    width: max-content;
    max-width: calc(100% - 36px);
    margin: 14px 18px 6px;
    padding: 4px;
    border-radius: 999px;
    background: var(--mud-palette-action-default-hover);
}

.tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    border: 0;
    border-radius: 999px;
    background: none;
    color: var(--mud-palette-text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.tab.on {
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    box-shadow: var(--shadow);
}

.tab-count {
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--mud-palette-secondary);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

/* ---------- Timeline ---------- */

.notes {
    white-space: pre-wrap;
}

.day-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin: 18px 0 2px;
}

.day-num {
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--mud-palette-primary-text);
    background: var(--mud-palette-primary);
}

.day-date {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

/* Each booking hangs off a rail: a coloured dot for its kind, joined by a line down the day. */
.tl-item {
    position: relative;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    column-gap: 10px;
}

.tl-item::before {
    content: "";
    position: absolute;
    left: 21px;
    top: 0;
    bottom: -10px;
    width: 2px;
    background: var(--mud-palette-lines-default);
}

.tl-item.last::before {
    bottom: auto;
    height: 24px;
}

.tl-dot {
    position: relative;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-top: 10px;
    border-radius: 50%;
    color: #fff;
    background: var(--type);
    box-shadow: 0 0 0 4px var(--mud-palette-background);
}

.tl-dot.small {
    width: 14px;
    height: 14px;
    margin: 14px 15px 0;
    background: var(--mud-palette-background);
    border: 3px solid var(--type);
    box-sizing: border-box;
}

.segment-card {
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--mud-palette-surface);
    box-shadow: var(--shadow);
}

.segment-main, .segment-end, .choice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    border: 0;
    background: none;
    color: inherit;
    font-size: inherit;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.segment-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.segment-kind {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--type);
}

.segment-title {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.segment-times {
    font-size: 0.95rem;
}

.segment-sub {
    font-size: 0.85rem;
    color: var(--mud-palette-text-secondary);
}

.segment-chevron {
    flex: none;
    align-self: center;
    color: var(--mud-palette-text-disabled);
}

/* A flight reads like a boarding pass: where from, where to, and the times under each. */
/* Three rows: the two codes with the path between them, then the times, then the cities.
   The two ends are laid straight into the grid so each row lines up across the card. */
.flight {
    display: grid;
    grid-template-columns: auto minmax(58px, 1fr) auto;
    align-items: center;
    column-gap: 10px;
    row-gap: 2px;
    margin-top: 2px;
}

.flight-end {
    display: contents;
}

.flight-end > * {
    grid-column: 1 / span 2;
    white-space: nowrap;
}

.flight-end.to > * {
    grid-column: 2 / span 2;
    justify-self: end;
    text-align: right;
}

.flight-code { grid-row: 1; }
.flight-time { grid-row: 2; }
.flight-city { grid-row: 3; }

.flight-end > .flight-code {
    grid-column: 1;
}

.flight-end.to > .flight-code {
    grid-column: 3;
}

.flight-path {
    grid-row: 1;
    grid-column: 2;
}

.flight-path span {
    white-space: nowrap;
}

.flight-time sup {
    margin-left: 3px;
    font-size: 0.7em;
    font-weight: 800;
    color: var(--type);
}

.flight-code {
    font-size: clamp(1.5rem, 7vw, 1.9rem);
    font-weight: 800;
    letter-spacing: 0.01em;
    line-height: 1;
}

.flight-time {
    font-size: 0.95rem;
    font-weight: 600;
}

.flight-city {
    font-size: 0.8rem;
    color: var(--mud-palette-text-secondary);
}

.flight-path {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--type);
    font-size: 0.78rem;
    font-weight: 600;
}

.flight-path::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 11px;
    border-top: 2px dashed currentColor;
    opacity: 0.45;
}

.flight-path .mud-icon-root {
    position: relative;
    padding: 0 6px;
    background: var(--mud-palette-surface);
    transform: rotate(90deg);
}

.segment-card.cancelled {
    opacity: 0.6;
}

.segment-card.cancelled .segment-title,
.segment-card.cancelled .segment-times,
.segment-card.cancelled .flight-code,
.segment-card.cancelled .flight-time {
    text-decoration: line-through;
}

.segment-extra {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    padding: 0 16px 14px;
}

.segment-extra.flush {
    padding: 0;
}

/* The line for leaving a stay or returning a car. */
.segment-end {
    align-items: center;
    justify-content: flex-start;
    padding: 10px 2px;
    font-size: 0.92rem;
    color: var(--mud-palette-text-secondary);
}

.segment-end > span {
    flex: 1;
}

.segment-end b {
    color: var(--mud-palette-text-primary);
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border: 0;
    border-radius: 999px;
    background: var(--mud-palette-action-default-hover);
    color: inherit;
    font-size: 0.82rem;
    white-space: nowrap;
}

.pill-copy {
    cursor: pointer;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--mud-palette-primary);
    background: var(--mud-palette-primary-hover);
}

.pill-cancelled {
    flex: none;
    align-self: flex-start;
    font-weight: 700;
    color: #fff;
    background: var(--mud-palette-secondary);
}

.segment-address {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-basis: 100%;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--mud-palette-primary);
    text-decoration: none;
    overflow-wrap: anywhere;
}

button.segment-address {
    padding: 0;
    border: 0;
    background: none;
    text-align: left;
    cursor: pointer;
}

/* ---------- Forms and dialogs ---------- */

.field-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 12px;
}

.field-row > .mud-input-control {
    flex: 1 1 150px;
    min-width: 0;
}

.field-row > .mud-button-root {
    margin-top: 10px;
}

.choice-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.choice {
    align-items: center;
    box-sizing: border-box;
    border-radius: 18px;
    background: var(--mud-palette-action-default-hover);
    text-decoration: none;
}

.choice:hover {
    background: var(--mud-palette-primary-hover);
}

.choice small {
    color: var(--mud-palette-text-secondary);
}

/* ---------- Review ---------- */

.review-card {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: var(--mud-palette-surface);
    color: inherit;
    text-decoration: none;
    box-shadow: var(--shadow);
}


.review-card b {
    font-size: 1.05rem;
    overflow-wrap: anywhere;
}

.review-card small {
    color: var(--mud-palette-text-secondary);
}

.upload-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--mud-palette-primary-text);
    background: var(--mud-palette-primary);
    cursor: pointer;
}

.upload-button input {
    display: none;
}

.review-body {
    gap: 12px;
}

.review-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.email-frame {
    width: 100%;
    height: 65vh;
    border: 0;
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
}

.email-text {
    margin: 0;
    padding: 14px;
    border-radius: var(--radius);
    background: var(--mud-palette-surface);
    box-shadow: var(--shadow);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* ---------- Settings ---------- */

.settings {
    gap: 14px;
}

.settings .mud-typography-subtitle1 {
    font-size: 1.1rem;
    font-weight: 800;
}

.copy-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.copy-row code {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--mud-palette-background);
    overflow-wrap: anywhere;
}

/* ---------- Maps ---------- */

/* Leaflet stacks its layers up to z-index 1000. Keep that inside the map. */
.map-view {
    position: relative;
    z-index: 0;
    isolation: isolate;
    width: 100%;
    height: 100%;
    background: var(--mud-palette-surface);
}

.map-page {
    position: relative;
    height: 100%;
}

.trip-map {
    height: min(48vh, 440px);
    margin: 6px 18px 10px;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.map-top {
    position: absolute;
    top: calc(12px + env(safe-area-inset-top));
    left: 12px;
    right: 12px;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 560px;
    pointer-events: none;
}

.map-top > * {
    pointer-events: auto;
}

.map-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px 4px 16px;
    min-height: 52px;
    border-radius: 999px;
    background: var(--mud-palette-surface);
    box-shadow: var(--shadow-lift);
}

.map-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: none;
    color: var(--mud-palette-text-primary);
    font-size: 16px; /* smaller makes iOS zoom the page on focus */
}

.map-search input::-webkit-search-cancel-button {
    display: none;
}

.map-results {
    display: flex;
    flex-direction: column;
    max-height: 50vh;
    overflow-y: auto;
    border-radius: var(--radius);
    background: var(--mud-palette-surface);
    box-shadow: var(--shadow-lift);
}

.map-result {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 12px 16px;
    border: 0;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    background: none;
    color: var(--mud-palette-text-primary);
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
}

.map-result:last-child {
    border-bottom: 0;
}

.map-result small {
    color: var(--mud-palette-text-secondary);
}

.chip-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0 2px 6px;
    scrollbar-width: none;
}

.chip-row::-webkit-scrollbar {
    display: none;
}

.filter-chip {
    flex: none;
    padding: 8px 14px;
    border: 0;
    border-radius: 999px;
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    font-size: 0.86rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: var(--shadow);
    -webkit-tap-highlight-color: transparent;
}

.filter-chip.on {
    background: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text);
}

.map-hint {
    position: absolute;
    left: 50%;
    bottom: 24px;
    z-index: 1;
    transform: translateX(-50%);
    width: max-content;
    max-width: calc(100% - 32px);
    padding: 10px 18px;
    border-radius: 999px;
    background: var(--mud-palette-surface);
    box-shadow: var(--shadow-lift);
    font-size: 0.92rem;
    text-align: center;
}

.map-hint-action {
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 22px;
    text-align: left;
}

/* The pin's details: a sheet along the bottom on a phone, a card in the corner when wide. */
.place-sheet {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 62%;
    overflow-y: auto;
    padding: 10px 18px 20px;
    border-radius: 28px 28px 0 0;
    background: var(--mud-palette-surface);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25);
}

/* The little bar that says "this is a sheet". */
.place-sheet::before {
    content: "";
    align-self: center;
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: var(--mud-palette-lines-default);
}

@media (min-width: 840px) {
    .place-sheet {
        left: 12px;
        right: auto;
        bottom: 12px;
        width: 420px;
        border-radius: 28px;
    }

    .place-sheet::before {
        display: none;
    }
}

.place-sheet-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.place-sheet-title {
    flex: 1;
    min-width: 0;
}

.place-sheet-title .mud-typography-h6 {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.place-sheet-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.place-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius);
    background: var(--mud-palette-surface);
    box-shadow: var(--shadow);
}

.place-row-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font-size: 0.98rem;
    text-align: left;
}

button.place-row-text {
    cursor: pointer;
}

.place-row-text small {
    max-width: 100%;
    color: var(--mud-palette-text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- Pins ---------- */

/* A teardrop: a square with three round corners, turned so the sharp one points down. */
.pin {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 2px solid #fff;
    border-radius: 50% 50% 50% 0;
    background: var(--pin, #5c6a67);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
    transform: rotate(-45deg);
}

.pin span {
    transform: rotate(45deg);
    font-size: 15px;
    line-height: 1;
    color: #fff;
}

.pin-badge {
    flex: none;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 16px;
    background: var(--pin, #5c6a67);
    color: #fff;
    font-size: 20px;
    line-height: 1;
}

.pin-food { --pin: #e2673a; }
.pin-coffee { --pin: #8a5a3b; }
.pin-sight { --pin: #7a4fc4; }
.pin-outdoors { --pin: #2e8b57; }
.pin-stay { --pin: #2f6fb7; }
.pin-shop { --pin: #c4418a; }
.pin-other { --pin: #5c6a67; }

/* Visited: still on the map, but stepped back. */
.pin-been { --pin: #8d9996; }

.pin.pin-been {
    opacity: 0.85;
}

/* Bookings on a trip map: the app colour, square, so they read differently from places. */
.pin.pin-segment {
    --pin: #1f6f78;
    border-radius: 12px;
    transform: none;
}

.pin.pin-segment span {
    transform: none;
}

.pin.pin-draft {
    --pin: #f07a5c;
    border-style: dashed;
}

/* Cluster bubbles in the app colour instead of Leaflet's green and yellow. */
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large {
    background-color: rgba(31, 111, 120, 0.3) !important;
}

.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div {
    background-color: #1f6f78 !important;
    color: #fff !important;
    font-weight: 700;
}
