:root {
    --ink: #17211f;
    --muted: #66736f;
    --line: #dce5df;
    --surface: #ffffff;
    --surface-alt: #f4f8f5;
    --brand: #126c57;
    --brand-strong: #0b4639;
    --accent: #d9713c;
    --danger: #b42318;
}

body {
    background: var(--surface-alt);
    color: var(--ink);
}

header {
    z-index: 1000;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 6px 20px rgba(23, 33, 31, 0.08);
}

.siteBrand a {
    display: inline-flex;
    align-items: center;
    min-height: 48px;
    color: var(--brand-strong);
    font-size: 1.25rem;
    font-weight: 700;
}

.primaryButton,
.secondaryButton,
.iconTextButton,
.placeEditForm button,
.videoPlaceButton,
.videoSuggestionActions button,
.photoForm button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.primaryButton {
    background: var(--brand);
    color: #ffffff;
}

.secondaryButton,
.iconTextButton,
.placeEditForm button,
.videoPlaceButton,
.videoSuggestionActions button,
.photoForm button {
    background: #ffffff;
    color: var(--brand-strong);
    border-color: var(--line);
}

.eyebrow {
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.subtleCopy,
.authSubtle {
    color: var(--muted);
    font-size: 0.9rem;
}

.welcomeShell,
.authShell {
    min-height: calc(100vh - 118.5px);
    display: grid;
    place-items: center;
    padding: 2rem;
}

.welcomeHero,
.authPanel {
    width: min(720px, 100%);
    display: grid;
    gap: 1rem;
}

.welcomeHero h1,
.authPanel h1 {
    font-size: clamp(2.25rem, 5vw, 4.6rem);
}

.heroActions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.authPanel {
    max-width: 520px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 18px 50px rgba(23, 33, 31, 0.12);
}

.authForm,
.stackedForm {
    display: grid;
    gap: 0.75rem;
}

.authForm label,
.stackedForm label {
    font-weight: 700;
}

.authForm input,
.stackedForm input,
.stackedForm select,
.stackedForm textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    padding: 0.78rem 0.9rem;
}

.authForm input:focus,
.stackedForm input:focus,
.stackedForm select:focus,
.stackedForm textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(18, 108, 87, 0.16);
}

.authRow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.authCheckbox {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.authCheckbox input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--brand);
}

.authHint {
    color: var(--muted);
    font-size: 0.88rem;
}

.authAlert {
    border: 1px solid #f5b5ad;
    background: #fff4f2;
    color: var(--danger);
    padding: 0.75rem 1rem;
    border-radius: 8px;
}

.authSuccess {
    border: 1px solid #b7dbc9;
    background: #eef9f2;
    color: var(--brand-strong);
    padding: 0.75rem 1rem;
    border-radius: 8px;
}

.mapShell {
    height: calc(100vh - 118.5px);
    display: grid;
    grid-template-columns: minmax(320px, 420px) 1fr;
    overflow: hidden;
}

.mapSidebar {
    display: grid;
    align-content: start;
    grid-auto-rows: max-content;
    gap: 1rem;
    overflow-y: auto;
    padding: 1rem;
    background: var(--surface-alt);
    border-right: 1px solid var(--line);
}

.panelBlock {
    display: grid;
    gap: 0.85rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1rem;
}

.panelBlock h1 {
    font-size: 2rem;
}

.panelBlock h2 {
    font-size: 1.1rem;
}

.panelHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.panelHeader label {
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 700;
}

.compactSelect {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    padding: 0.62rem 0.72rem;
    font: inherit;
}

.statGrid,
.formGrid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.statGrid div {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.75rem;
}

.statGrid strong {
    display: block;
    color: var(--brand-strong);
    font-size: 1.5rem;
}

.statGrid span {
    color: var(--muted);
    font-size: 0.86rem;
}

.placeListBlock,
.videoListBlock {
    min-height: 160px;
}

.placeList,
.videoList {
    display: grid;
    gap: 0.75rem;
}

.placeListItem {
    display: grid;
    gap: 0.55rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.75rem;
    cursor: pointer;
}

.placeListItem strong {
    display: block;
}

.placeListHeader span {
    color: var(--brand);
    font-size: 0.84rem;
    font-weight: 700;
}

.placeListItem p {
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.45;
}

.placeEditForm {
    display: grid;
    gap: 0.5rem;
}

.placeEditForm input,
.placeEditForm select,
.placeEditForm textarea {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    padding: 0.62rem 0.72rem;
    font: inherit;
}

.placeEditForm textarea {
    resize: vertical;
}

.placeActions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
}

.placeActions button {
    min-height: 38px;
    padding: 0.55rem 0.6rem;
    font-size: 0.85rem;
}

.placeActions .deletePlaceButton {
    color: var(--danger);
}

.placeActions .restorePlaceButton {
    color: var(--brand);
}

.videoListItem {
    display: grid;
    gap: 0.55rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.75rem;
}

.videoListItem a {
    color: var(--brand);
    font-weight: 700;
    overflow-wrap: anywhere;
}

.videoListHeader {
    display: grid;
    gap: 0.4rem;
}

.videoListHeader strong {
    overflow-wrap: anywhere;
}

.videoStatus {
    width: fit-content;
    border-radius: 999px;
    background: var(--surface-alt);
    color: var(--brand-strong);
    border: 1px solid var(--line);
    padding: 0.22rem 0.5rem;
    font-size: 0.78rem;
    font-weight: 700;
}

.videoStatus-processing,
.videoStatus-pending {
    color: var(--accent);
}

.videoStatus-failed,
.videoStatus-needs_review {
    color: var(--danger);
}

.videoMeta {
    display: grid;
    gap: 0.4rem;
    margin: 0;
    color: var(--muted);
    font-size: 0.86rem;
}

.videoMeta div {
    display: flex;
    gap: 0.35rem;
    min-width: 0;
}

.videoMeta dt {
    font-weight: 700;
}

.videoMeta dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.videoError {
    border: 1px solid #f5b5ad;
    border-radius: 8px;
    background: #fff4f2;
    color: var(--danger);
    padding: 0.55rem 0.65rem;
    font-size: 0.86rem;
}

.videoPlaceLinks {
    display: grid;
    gap: 0.45rem;
}

.videoPlaceButton {
    min-height: 38px;
    justify-content: flex-start;
    padding: 0.55rem 0.65rem;
    font-size: 0.85rem;
    overflow-wrap: anywhere;
}

.videoSuggestions {
    display: grid;
    gap: 0.5rem;
}

.videoSuggestion {
    display: grid;
    gap: 0.35rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-alt);
    padding: 0.65rem;
}

.videoSuggestion span,
.videoSuggestion small,
.videoSuggestion p {
    color: var(--muted);
    font-size: 0.84rem;
}

.videoSuggestion p {
    margin: 0;
    line-height: 1.4;
}

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

.videoSuggestionActions button {
    min-height: 36px;
    padding: 0.5rem 0.55rem;
    font-size: 0.82rem;
}

.dismissSuggestionButton {
    color: var(--danger);
}

.photoForm {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
    align-items: center;
}

.photoForm input {
    min-width: 0;
    font-size: 0.84rem;
}

.mapCanvasWrap {
    position: relative;
    min-width: 0;
}

.travelMap {
    width: 100%;
    height: 100%;
    min-height: 520px;
    background: #d8e5dd;
}

.mapToolbar {
    position: absolute;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    z-index: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    pointer-events: none;
}

.mapToolbar > * {
    pointer-events: auto;
}

.mapToolbar span {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.7rem 0.85rem;
    color: var(--muted);
    font-size: 0.88rem;
}

.appMessage {
    position: sticky;
    bottom: 1rem;
    min-height: 0;
    border-radius: 8px;
    padding: 0;
    font-weight: 700;
}

.appMessage:not(:empty) {
    background: var(--brand-strong);
    color: #ffffff;
    padding: 0.75rem 1rem;
}

.appMessage[data-type="error"]:not(:empty) {
    background: var(--danger);
}

.popupLinks {
    display: grid;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.popupLinks a {
    color: var(--brand);
    font-weight: 700;
}

.popupPhotos {
    display: flex;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.popupPhotos img {
    width: 58px;
    height: 58px;
    object-fit: cover;
    border-radius: 6px;
}

@media only screen and (max-width: 900px) {
    .mapShell {
        height: auto;
        min-height: calc(100vh - 118.5px);
        grid-template-columns: 1fr;
    }

    .mapSidebar {
        order: 2;
        border-right: 0;
        border-top: 1px solid var(--line);
    }

    .mapCanvasWrap {
        order: 1;
        height: 58vh;
    }

    .mapToolbar {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media only screen and (max-width: 640px) {
    .authPanel,
    .panelBlock {
        padding: 1rem;
    }

    .welcomeShell,
    .authShell {
        padding: 1rem;
    }

    .statGrid,
    .formGrid,
    .placeActions,
    .videoSuggestionActions,
    .photoForm {
        grid-template-columns: 1fr;
    }

    .mapCanvasWrap {
        height: 52vh;
    }
}
