:root{font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:#17211b;background:#f4f7f4}*{box-sizing:border-box}body{margin:0}.topbar{height:58px;background:#183b2b;color:white;display:flex;align-items:center;justify-content:space-between;padding:0 18px}.topbar nav{display:flex;gap:14px;align-items:center}.topbar a{color:white;text-decoration:none}.topbar button{width:auto;background:#fff;color:#183b2b;padding:8px 12px}.app-shell{display:grid;grid-template-columns:320px 1fr;height:calc(100vh - 58px)}.sidebar{padding:16px;overflow:auto;background:white;border-right:1px solid #d9e0da}.sidebar h2{font-size:1rem;margin-top:20px}.sidebar label,.login-card label{display:grid;gap:5px;margin:10px 0}input,select,button{font:inherit;padding:10px;border:1px solid #aeb8b0;border-radius:7px}button{background:#246b47;color:white;border:0;cursor:pointer;width:100%;margin:6px 0}button:disabled{opacity:.5;cursor:not-allowed}#map{min-height:400px}.login-page{min-height:100vh;display:grid;place-items:center}.card{background:white;border:1px solid #d9e0da;border-radius:12px;padding:28px;box-shadow:0 8px 30px rgba(0,0,0,.08)}.login-card{width:min(420px,92vw)}.message{min-height:1.3em;color:#9a2a2a}.muted{color:#687269;font-size:.9rem}.admin-wrap{padding:24px;max-width:1100px;margin:auto}table{width:100%;border-collapse:collapse;background:white}th,td{text-align:left;padding:10px;border-bottom:1px solid #e1e6e2}td button{width:auto;padding:7px 12px}@media(max-width:760px){.app-shell{grid-template-columns:1fr;grid-template-rows:auto 60vh;height:auto}.sidebar{border-right:0}.topbar{position:sticky;top:0;z-index:5}}

.weather-forecast-day {
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(127, 127, 127, 0.35);
}

.weather-forecast-day:last-child {
    border-bottom: 0;
}

#savedRouteDetailsPanel {
    margin-top: 1rem;
    padding: 0.9rem;
    border: 1px solid rgba(127, 127, 127, 0.4);
    border-radius: 0.5rem;
}

#savedRouteDetailsPanel button {
    margin-top: 0.4rem;
}

#savedRouteDetailsResult {
    line-height: 1.55;
}

.route-elevation-profile {
    margin: 1rem 0;
}

.route-elevation-profile svg {
    display: block;
    width: 100%;
    height: auto;
    min-height: 180px;
    overflow: visible;
    background: rgba(127, 127, 127, 0.06);
    border: 1px solid rgba(127, 127, 127, 0.35);
    border-radius: 0.45rem;
}

.route-profile-grid {
    stroke: currentColor;
    stroke-width: 1;
    opacity: 0.13;
}

.route-profile-area {
    fill: rgba(52, 152, 219, 0.22);
    stroke: none;
}

.route-profile-line {
    fill: none;
    stroke: currentColor;
    stroke-width: 3;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.route-profile-label {
    fill: currentColor;
    font-size: 13px;
}

.route-profile-axis-title {
    fill: currentColor;
    font-size: 14px;
    font-weight: 600;
}

.movement-settings-panel,
.route-activity-editor {
    margin: 0.9rem 0;
    padding: 0.85rem;
    border: 1px solid rgba(127, 127, 127, 0.38);
    border-radius: 0.55rem;
    background: rgba(127, 127, 127, 0.04);
}

.secondary-button {
    background: #687269;
}

.route-gradient-warning {
    padding: 0.7rem;
    border-left: 4px solid #b6402c;
    background: rgba(182, 64, 44, 0.1);
}

.route-profile-gradient {
    fill: none;
    stroke-width: 4;
    stroke-linecap: round;
}

.route-profile-flat {
    stroke: #3d8b5f;
}

.route-profile-moderate {
    stroke: #d4a017;
}

.route-profile-steep {
    stroke: #d66a24;
}

.route-profile-very-steep {
    stroke: #b52d2d;
}

.route-planner-panel {
    margin: 1rem 0;
    padding: 0.9rem;
    border: 1px solid rgba(127, 127, 127, 0.38);
    border-radius: 0.55rem;
    background: rgba(127, 127, 127, 0.04);
}

.route-planner-summary {
    padding: 0.7rem;
    line-height: 1.5;
    background: rgba(36, 107, 71, 0.08);
    border-radius: 0.45rem;
}

.route-planner-point {
    display: block;
    width: 18px;
    height: 18px;
    min-width: 18px;
    padding: 0;
    margin: 0;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #d35400;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.55);
    cursor: grab;
}

.route-planner-point:active {
    cursor: grabbing;
}

.danger-button {
    background: #a93226;
}

.saved-content-library {
    min-height: calc(100vh - 58px);
    padding: 1rem;
    background: #f4f1fa;
}

.saved-library-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto 1rem;
}

.saved-library-header button {
    width: auto;
}

.saved-library-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
    max-width: 1200px;
    margin: 0 auto 1rem;
    padding: 0.35rem;
    border-radius: 0.7rem;
    background: #ded3f0;
}

.saved-library-tab {
    margin: 0;
    background: transparent;
    color: #372450;
}

.saved-library-tab.active {
    background: #6d4b91;
    color: #fff;
}

.saved-library-filters {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.75rem;
    max-width: 1200px;
    margin: 0 auto 1rem;
    padding: 1rem;
    border: 1px solid #d1c4e2;
    border-radius: 0.75rem;
    background: #fff;
}

.saved-library-list {
    display: grid;
    gap: 0.85rem;
    max-width: 1200px;
    margin: 0 auto;
}

.saved-library-card {
    padding: 1rem;
    border: 1px solid #d6cbe5;
    border-radius: 0.8rem;
    background: #fff;
    box-shadow: 0 2px 8px rgba(45, 26, 70, 0.08);
}

.saved-library-card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.saved-library-card-heading h3 {
    margin: 0;
}

.saved-library-card-heading span {
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    background: #ede5f7;
    color: #4a3167;
    white-space: nowrap;
}

.saved-library-stats {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.6rem;
}

.saved-library-stats div {
    padding: 0.55rem;
    border-radius: 0.45rem;
    background: #f6f3fa;
}

.saved-library-stats dt {
    font-size: 0.8rem;
    color: #6c6274;
}

.saved-library-stats dd {
    margin: 0.15rem 0 0;
    font-weight: 700;
}

.saved-library-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.8rem;
}

.saved-library-actions button {
    width: auto;
    margin: 0;
    padding: 0.55rem 0.75rem;
}

.saved-location-group {
    padding: 0.8rem;
    border-radius: 0.8rem;
    background: rgba(109, 75, 145, 0.08);
}

.saved-location-group > h2 {
    margin-top: 0;
    color: #4b3267;
}

.saved-location-group > h2 small {
    font-weight: 400;
}

.saved-library-empty {
    padding: 1rem;
    text-align: center;
    border-radius: 0.65rem;
    background: #fff;
}

.topbar nav button {
    margin: 0;
}

.saved-content-dialog {
    width: min(94vw, 620px);
    max-height: 90vh;
    padding: 0;
    border: 0;
    border-radius: 0.85rem;
    background: #f4f1fa;
    color: inherit;
}

.saved-content-dialog::backdrop {
    background: rgba(0, 0, 0, 0.62);
}

.saved-content-dialog form {
    display: grid;
    gap: 0.8rem;
    padding: 1rem;
    overflow-y: auto;
    max-height: 86vh;
}

.saved-content-dialog h2 {
    margin: 0;
    color: #4b3267;
}

.saved-content-dialog textarea {
    width: 100%;
    resize: vertical;
}

.saved-content-dialog-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.saved-content-dialog-actions button {
    width: auto;
    margin: 0;
}

.saved-content-photo-preview {
    display: grid;
    gap: 0.55rem;
    padding: 0.65rem;
    border: 1px solid #d1c4e2;
    border-radius: 0.65rem;
    background: #fff;
}

.saved-content-photo-preview img {
    display: block;
    width: 100%;
    max-height: 360px;
    object-fit: contain;
    border-radius: 0.45rem;
}

.saved-content-photo-preview[hidden] {
    display: none !important;
}

.saved-library-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    max-width: 1200px;
    margin: 0 auto 1rem;
}

.saved-library-toolbar button {
    width: auto;
    margin: 0;
}

.saved-detail-dialog {
    width: min(94vw, 760px);
}

.saved-detail-dialog article {
    display: grid;
    gap: 1rem;
    padding: 1rem;
    max-height: 88vh;
    overflow-y: auto;
}

.saved-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.saved-detail-header h2 {
    margin: 0;
}

.saved-detail-header button {
    width: auto;
    flex-shrink: 0;
}

.saved-detail-type {
    margin: 0 0 0.2rem;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #6d4b91;
}

.saved-detail-photo[hidden] {
    display: none !important;
}

.saved-detail-photo img {
    display: block;
    width: 100%;
    max-height: 480px;
    object-fit: contain;
    border-radius: 0.7rem;
    background: #fff;
}

.saved-detail-grid {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.7rem;
    margin: 0;
}

.saved-detail-grid > div {
    padding: 0.75rem;
    border-radius: 0.55rem;
    background: #fff;
    border: 1px solid #ded4ea;
}

.saved-detail-grid dt {
    margin-bottom: 0.2rem;
    color: #6c6274;
    font-size: 0.82rem;
}

.saved-detail-grid dd {
    margin: 0;
    font-weight: 650;
    overflow-wrap: anywhere;
}

.saved-detail-notes {
    padding: 0.85rem;
    border-radius: 0.6rem;
    background: #fff;
    border: 1px solid #ded4ea;
}

.saved-detail-notes h3 {
    margin-top: 0;
}

.saved-detail-notes p {
    margin-bottom: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

@media (max-width: 720px) {
    .saved-content-library {
        padding: 0.65rem;
    }

    .saved-library-header {
        align-items: stretch;
        flex-direction: column;
    }

    .saved-library-header button {
        width: 100%;
    }

    .saved-library-card-heading {
        flex-direction: column;
    }

    .saved-library-card-heading span {
        white-space: normal;
    }

    .saved-library-actions {
        display: grid;
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .saved-library-actions button {
        width: 100%;
    }

    .saved-library-toolbar {
        display: grid;
        grid-template-columns: 1fr;
    }

    .saved-library-toolbar button {
        width: 100%;
    }

    .saved-detail-header {
        flex-direction: column;
    }

    .saved-detail-header button {
        width: 100%;
    }

    .saved-detail-grid {
        grid-template-columns: 1fr;
    }

    .saved-content-dialog {
        width: calc(100vw - 1rem);
        max-height: calc(100vh - 1rem);
    }

    .saved-content-dialog form,
    .saved-detail-dialog article {
        max-height: calc(100vh - 2rem);
    }
}

@media (max-width: 420px) {
    .saved-library-actions {
        grid-template-columns: 1fr;
    }
}

.explorer-dialog {
    width: min(96vw, 1100px);
    max-height: 94vh;
    padding: 0;
    border: 0;
    border-radius: 0.9rem;
    background: #f4f1fa;
    color: inherit;
}

.explorer-dialog::backdrop {
    background: rgba(0, 0, 0, 0.68);
}

.explorer-shell {
    display: grid;
    gap: 1rem;
    max-height: 92vh;
    padding: 1rem;
    overflow-y: auto;
}

.explorer-header,
.explorer-section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.explorer-header h2,
.explorer-section-header h3 {
    margin: 0;
}

.explorer-header button,
.explorer-section-header button {
    width: auto;
}

.explorer-eyebrow,
#explorerCatalogueCountry,
#explorerDetailCategory {
    margin: 0 0 0.2rem;
    color: #6d4b91;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.explorer-status {
    min-height: 1.3rem;
    margin: 0;
}

.explorer-country-grid {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(270px, 1fr));
    gap: 1rem;
}

.explorer-country-card {
    display: grid;
    gap: 0.75rem;
    padding: 1rem;
    border: 1px solid #d7cce5;
    border-radius: 0.8rem;
    background: #fff;
}

.explorer-country-card h3,
.explorer-country-card p {
    margin: 0;
}

.explorer-country-card progress {
    width: 100%;
}

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

.explorer-category-grid button {
    display: grid;
    gap: 0.15rem;
    text-align: left;
}

.explorer-filters {
    display: grid;
    grid-template-columns:
        repeat(4, minmax(150px, 1fr));
    gap: 0.65rem;
}

.explorer-search-label {
    grid-column: 1 / -1;
}

.explorer-results {
    display: grid;
    gap: 0.5rem;
}

.explorer-result-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.55rem;
    align-items: stretch;
    padding: 0.55rem;
    border: 1px solid #d7cce5;
    border-radius: 0.65rem;
    background: #fff;
}

.explorer-result-main {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.7rem;
    align-items: center;
    width: 100%;
    text-align: left;
    background: transparent;
    color: inherit;
    border: 0;
}

.explorer-result-main small {
    display: block;
    margin-top: 0.2rem;
    color: #665e6e;
}

.explorer-completion-mark {
    display: grid;
    place-items: center;
    width: 2.2rem;
    height: 2.2rem;
    border: 2px solid currentColor;
    border-radius: 50%;
    font-weight: 800;
}

.explorer-empty {
    padding: 1rem;
    border-radius: 0.65rem;
    background: #fff;
}

.explorer-detail-grid {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.65rem;
    margin: 0 0 1rem;
}

.explorer-detail-grid > div {
    padding: 0.7rem;
    border: 1px solid #d7cce5;
    border-radius: 0.6rem;
    background: #fff;
}

.explorer-detail-grid dt {
    margin-bottom: 0.2rem;
    color: #685f70;
    font-size: 0.82rem;
}

.explorer-detail-grid dd {
    margin: 0;
    font-weight: 650;
    overflow-wrap: anywhere;
}

#explorerProgressForm {
    display: grid;
    gap: 0.75rem;
}

.explorer-completed-label {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.75rem;
    border-radius: 0.6rem;
    background: #fff;
}

.explorer-completed-label input {
    width: auto;
}

.explorer-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.explorer-detail-actions button {
    width: auto;
}

@media (max-width: 760px) {
    .explorer-dialog {
        width: calc(100vw - 0.5rem);
        max-height: calc(100vh - 0.5rem);
    }

    .explorer-shell {
        max-height: calc(100vh - 1rem);
        padding: 0.7rem;
    }

    .explorer-header,
    .explorer-section-header {
        flex-direction: column;
    }

    .explorer-header button,
    .explorer-section-header button {
        width: 100%;
    }

    .explorer-filters {
        grid-template-columns: 1fr;
    }

    .explorer-search-label {
        grid-column: auto;
    }

    .explorer-result-row {
        grid-template-columns: 1fr;
    }

    .explorer-result-row > button {
        width: 100%;
    }

    .explorer-detail-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .explorer-detail-actions button {
        width: 100%;
    }
}

@media (max-width: 460px) {
    .explorer-country-grid,
    .explorer-category-grid,
    .explorer-detail-grid {
        grid-template-columns: 1fr;
    }
}

.explorer-country-choice {
    display: grid;
    gap: 0.65rem;
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid #d7cce5;
    border-radius: 0.8rem;
    background: #fff;
}

.explorer-country-choice h3,
.explorer-country-choice p {
    margin: 0;
}

.explorer-country-choice-buttons {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

.explorer-country-choice-buttons button {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    min-height: 4.5rem;
    text-align: left;
    background: #f5f1fa;
    color: inherit;
    border: 2px solid transparent;
}

.explorer-country-choice-buttons button.is-selected,
.explorer-country-choice-buttons button[aria-pressed="true"] {
    border-color: #65418a;
    background: #ece2f6;
    box-shadow: 0 0 0 2px rgba(101, 65, 138, 0.15);
}

.explorer-country-flag {
    font-size: 2rem;
    line-height: 1;
}

.explorer-country-heading {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
}

.explorer-country-card-flag {
    font-size: 2.4rem;
    line-height: 1;
}

@media (max-width: 460px) {
    .explorer-country-choice-buttons {
        grid-template-columns: 1fr;
    }
}

.explorer-completion-state {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.8rem;
    align-items: center;
    padding: 0.9rem;
    margin-bottom: 1rem;
    border: 2px solid;
    border-radius: 0.75rem;
    transition:
        background-color 160ms ease,
        border-color 160ms ease;
}

.explorer-completion-state.is-outstanding {
    border-color: #8b7e98;
    background: #f4f1f7;
}

.explorer-completion-state.is-completed {
    border-color: #287a49;
    background: #e8f7ee;
}

.explorer-completion-state-icon {
    display: grid;
    place-items: center;
    width: 2.8rem;
    height: 2.8rem;
    border: 2px solid currentColor;
    border-radius: 50%;
    font-size: 1.45rem;
    font-weight: 800;
}

.explorer-completion-state.is-outstanding
.explorer-completion-state-icon {
    color: #655d6d;
}

.explorer-completion-state.is-completed
.explorer-completion-state-icon {
    color: #1f6c3d;
}

.explorer-completion-state strong {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 1.08rem;
}

.explorer-completion-state p {
    margin: 0;
}

.explorer-save-confirmation {
    margin-bottom: 1rem;
    padding: 0.8rem;
    border: 1px solid #287a49;
    border-radius: 0.65rem;
    background: #e8f7ee;
    color: #174d2d;
    font-weight: 700;
}

.explorer-save-confirmation[hidden] {
    display: none !important;
}

#explorerSaveProgress:disabled {
    cursor: wait;
    opacity: 0.72;
}

@media (max-width: 460px) {
    .explorer-completion-state {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .explorer-completion-state-icon {
        margin: 0 auto;
    }
}

.explorer-home-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-bottom: 1rem;
}

.explorer-home-actions button {
    width: auto;
}

@media (max-width: 600px) {
    .explorer-home-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .explorer-home-actions button {
        width: 100%;
    }
}

.explorer-photo-section {
    display: grid;
    gap: 0.75rem;
    padding: 0.85rem;
    border: 1px solid #d7cce5;
    border-radius: 0.7rem;
    background: #fff;
}

.explorer-photo-section h4,
.explorer-photo-section p {
    margin: 0;
}

.explorer-photo-help {
    color: #665e6e;
    font-size: 0.85rem;
}

.explorer-photo-gallery {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.7rem;
}

.explorer-photo-card {
    display: grid;
    gap: 0.45rem;
    margin: 0;
    padding: 0.55rem;
    border: 1px solid #d7cce5;
    border-radius: 0.6rem;
    background: #f8f6fb;
}

.explorer-photo-card img {
    display: block;
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 0.45rem;
    background: #eee;
}

.explorer-photo-card figcaption {
    overflow-wrap: anywhere;
    font-size: 0.85rem;
}

.explorer-photo-card button {
    width: 100%;
}

@media (max-width: 520px) {
    .explorer-photo-gallery {
        grid-template-columns: 1fr;
    }

    .explorer-photo-card img {
        height: auto;
        max-height: 380px;
        object-fit: contain;
    }
}

.explorer-personal-section {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid #d7cce5;
    border-radius: 0.8rem;
    background: #fff;
}

.explorer-personal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.explorer-personal-header h3,
.explorer-personal-header p {
    margin: 0;
}

.explorer-personal-header button {
    width: auto;
}

.explorer-personal-archive-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.explorer-personal-archive-toggle input {
    width: auto;
}

.explorer-personal-list {
    display: grid;
    gap: 0.65rem;
}

.explorer-personal-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.8rem;
    padding: 0.8rem;
    border: 1px solid #d7cce5;
    border-radius: 0.65rem;
    background: #f8f6fb;
}

.explorer-personal-card p {
    margin: 0.25rem 0 0;
    white-space: pre-wrap;
}

.explorer-personal-actions {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 0.45rem;
}

.explorer-personal-actions button {
    width: auto;
}

@media (max-width: 700px) {
    .explorer-personal-header,
    .explorer-personal-card {
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    .explorer-personal-header button,
    .explorer-personal-actions button {
        width: 100%;
    }

    .explorer-personal-actions {
        display: grid;
        grid-template-columns: 1fr;
    }
}

.settings-menu-dialog {
    width: min(92vw, 680px);
    max-height: 88vh;
    padding: 0;
    border: 0;
    border-radius: 0.9rem;
    box-shadow:
        0 20px 60px rgba(20, 15, 25, 0.35);
}

.settings-menu-dialog::backdrop {
    background: rgba(15, 12, 18, 0.55);
}

.settings-menu-shell {
    display: grid;
    gap: 1rem;
    max-height: 88vh;
    padding: 1rem;
    overflow-y: auto;
    background: #f8f6fb;
}

.settings-menu-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.settings-menu-header h2,
.settings-menu-header p {
    margin: 0;
}

.settings-menu-eyebrow {
    color: #6b5d76;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.settings-menu-header button {
    width: auto;
}

.settings-menu-section {
    display: grid;
    gap: 0.75rem;
    padding: 1rem;
    border: 1px solid #d7cce5;
    border-radius: 0.75rem;
    background: #fff;
}

.settings-menu-section h3,
.settings-menu-section p {
    margin: 0;
}

.settings-menu-section form {
    display: grid;
    gap: 0.7rem;
}

.settings-menu-section input[type="file"] {
    width: 100%;
}

.settings-menu-section .movement-settings-panel {
    margin-top: 0.25rem;
}

@media (max-width: 600px) {
    .settings-menu-dialog {
        width: calc(100vw - 1rem);
        max-height: calc(100vh - 1rem);
    }

    .settings-menu-shell {
        max-height: calc(100vh - 1rem);
    }

    .settings-menu-header {
        align-items: stretch;
        flex-direction: column;
    }

    .settings-menu-header button {
        width: 100%;
    }
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.topbar {
    position: relative;
    z-index: 30;
}

.topbar-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.fieldmarks-brand {
    flex: 0 0 auto;
    white-space: nowrap;
}

.topbar-search-wrap {
    position: relative;
    flex: 1 1 420px;
    width: min(48vw, 560px);
    min-width: 190px;
    max-width: 560px;
}

.topbar-search-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 0.35rem;
    margin: 0;
}

.topbar-search-form input {
    width: 100%;
    min-width: 0;
    margin: 0;
}

.header-icon-button,
.header-toggle-button {
    display: inline-grid;
    place-items: center;
    width: 2.65rem;
    min-width: 2.65rem;
    height: 2.65rem;
    min-height: 2.65rem;
    padding: 0.55rem;
    border: 1px solid #b9b3bd;
    border-radius: 0.55rem;
    background: #f2f1f3;
    color: #77717b;
    cursor: pointer;
}

.header-icon-button:hover,
.header-toggle-button:hover {
    border-color: #9d7b3a;
    background: #fff7e5;
}

.header-icon-button svg,
.header-toggle-button svg {
    display: block;
    width: 1.35rem;
    height: 1.35rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.header-toggle-button {
    position: relative;
    margin: 0;
}

.header-toggle-button input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}

.header-toggle-button:has(input:checked) {
    border-color: #c58a1c;
    background: #fff3d2;
    color: #b87400;
}

.header-toggle-button:focus-within {
    outline: 3px solid rgba(197, 138, 28, 0.35);
    outline-offset: 2px;
}

.topbar-map-controls {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex: 0 0 auto;
}

.topbar-search-results {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    right: 0;
    z-index: 80;
    max-height: min(55vh, 420px);
    overflow-y: auto;
    padding: 0.4rem;
    border: 1px solid #cfc8d5;
    border-radius: 0.6rem;
    background: #fff;
    box-shadow:
        0 14px 35px rgba(24, 18, 29, 0.25);
}

.topbar-search-results button {
    width: 100%;
    text-align: left;
}

@media (max-width: 980px) {
    .topbar {
        align-items: stretch;
    }

    .topbar-main {
        flex-wrap: wrap;
        width: 100%;
    }

    .topbar-search-wrap {
        order: 3;
        flex-basis: 100%;
        width: 100%;
        max-width: none;
    }

    .topbar-map-controls {
        margin-left: auto;
    }
}

@media (max-width: 620px) {
    .fieldmarks-brand {
        font-size: 1rem;
    }

    .topbar-map-controls {
        gap: 0.25rem;
    }

    .header-icon-button,
    .header-toggle-button {
        width: 2.45rem;
        min-width: 2.45rem;
        height: 2.45rem;
        min-height: 2.45rem;
        padding: 0.48rem;
    }

    .topbar-search-form input {
        font-size: 16px;
    }
}

.fieldmarks-selected-popup
.maplibregl-popup-content {
    min-width: 245px;
    padding: 0.75rem;
    border-radius: 0.75rem;
    box-shadow:
        0 12px 32px rgba(25, 20, 29, 0.28);
}

.fieldmarks-selected-popup
.maplibregl-popup-close-button {
    top: 0.25rem;
    right: 0.35rem;
    width: 2rem;
    height: 2rem;
    padding: 0;
    color: #665e6e;
    font-size: 1.4rem;
    line-height: 1;
    background: transparent;
}

.selected-location-popup-menu {
    display: grid;
    gap: 0.65rem;
}

.selected-location-popup-title {
    padding-right: 1.8rem;
    color: #2f2934;
    font-size: 0.95rem;
}

.selected-location-popup-actions {
    display: grid;
    grid-template-columns:
        repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
}

.selected-popup-action {
    display: grid;
    place-items: center;
    width: 100%;
    min-width: 0;
    height: 2.75rem;
    min-height: 2.75rem;
    padding: 0.55rem;
    border: 1px solid #c8c1cd;
    border-radius: 0.55rem;
    background: #f5f3f6;
    color: #5f5864;
}

.selected-popup-action:hover,
.selected-popup-action:focus-visible {
    border-color: #c58a1c;
    background: #fff3d2;
    color: #a96900;
}

.selected-popup-action.danger:hover,
.selected-popup-action.danger:focus-visible {
    border-color: #b24242;
    background: #fff0f0;
    color: #a12f2f;
}

.selected-popup-action svg {
    display: block;
    width: 1.4rem;
    height: 1.4rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@media (max-width: 520px) {
    .fieldmarks-selected-popup
    .maplibregl-popup-content {
        min-width: 210px;
    }

    .selected-location-popup-actions {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));
    }
}

.selected-popup-action {
    position: relative;
}

.selected-popup-tooltip {
    position: absolute;
    top: calc(100% + 0.4rem);
    left: 50%;
    z-index: 20;
    width: max-content;
    max-width: 150px;
    padding: 0.28rem 0.45rem;
    border-radius: 0.35rem;
    background: rgba(42, 37, 46, 0.94);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
    white-space: normal;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform:
        translate(-50%, -0.15rem);
    transition:
        opacity 120ms ease,
        transform 120ms ease,
        visibility 120ms ease;
}

.selected-popup-tooltip::before {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    border: 0.3rem solid transparent;
    border-bottom-color:
        rgba(42, 37, 46, 0.94);
    transform: translateX(-50%);
}

.selected-popup-action:hover
.selected-popup-tooltip,
.selected-popup-action:focus-visible
.selected-popup-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

.selected-location-popup-actions
.selected-popup-action:nth-child(3n + 1)
.selected-popup-tooltip {
    left: 0;
    transform:
        translate(0, -0.15rem);
}

.selected-location-popup-actions
.selected-popup-action:nth-child(3n + 1):hover
.selected-popup-tooltip,
.selected-location-popup-actions
.selected-popup-action:nth-child(3n + 1):focus-visible
.selected-popup-tooltip {
    transform: translate(0, 0);
}

.selected-location-popup-actions
.selected-popup-action:nth-child(3n)
.selected-popup-tooltip {
    right: 0;
    left: auto;
    transform:
        translate(0, -0.15rem);
}

.selected-location-popup-actions
.selected-popup-action:nth-child(3n):hover
.selected-popup-tooltip,
.selected-location-popup-actions
.selected-popup-action:nth-child(3n):focus-visible
.selected-popup-tooltip {
    transform: translate(0, 0);
}

.selected-location-popup-actions
.selected-popup-action:nth-child(3n + 1)
.selected-popup-tooltip::before {
    left: 1.25rem;
}

.selected-location-popup-actions
.selected-popup-action:nth-child(3n)
.selected-popup-tooltip::before {
    right: 1.25rem;
    left: auto;
}

.app-shell {
    position: relative;
}

.map-layer-control {
    position: absolute;
    top: clamp(10.5rem, 22vh, 15rem);
    right: 0.65rem;
    z-index: 25;
    display: grid;
    justify-items: end;
    gap: 0.4rem;
    max-height: calc(100% - 1rem);
    pointer-events: none;
}

.map-layer-toggle,
.map-layer-menu {
    pointer-events: auto;
}

.map-layer-toggle {
    display: grid;
    place-items: center;
    width: 2.55rem;
    min-width: 2.55rem;
    height: 2.55rem;
    min-height: 2.55rem;
    padding: 0.5rem;
    border: 0;
    border-radius: 0.3rem;
    background: #fff;
    color: #4d4851;
    box-shadow:
        0 1px 4px rgba(0, 0, 0, 0.28);
    cursor: pointer;
}

.map-layer-toggle:hover,
.map-layer-toggle:focus-visible,
.map-layer-toggle.active {
    background: #fff3d2;
    color: #a96900;
}

.map-layer-toggle svg {
    display: block;
    width: 1.4rem;
    height: 1.4rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.map-layer-menu {
    width: min(17rem, calc(100vw - 2rem));
    padding: 0.75rem;
    border: 1px solid #cbc4d0;
    border-radius: 0.65rem;
    background: #fff;
    box-shadow:
        0 12px 32px rgba(25, 20, 29, 0.25);
}

.map-layer-menu[hidden] {
    display: none;
}

.map-layer-menu label {
    display: block;
    margin-bottom: 0.4rem;
    color: #38323d;
    font-size: 0.82rem;
    font-weight: 700;
}

.map-layer-menu select {
    width: 100%;
    margin: 0;
}

@media (max-width: 700px) {
    .map-layer-control {
        top: clamp(11.5rem, 27vh, 16rem);
        right: 0.5rem;
    }

    .map-layer-toggle {
        width: 2.45rem;
        min-width: 2.45rem;
        height: 2.45rem;
        min-height: 2.45rem;
    }

    .map-layer-menu {
        width: min(
            17rem,
            calc(100vw - 1.5rem)
        );
        max-height: min(
            55vh,
            24rem
        );
        overflow-y: auto;
    }
}
}

@media (max-height: 700px) {
    .map-layer-control {
        top: clamp(9rem, 25vh, 11.5rem);
    }

    .map-layer-menu {
        max-height: 50vh;
        overflow-y: auto;
    }
}

@media (
    max-width: 700px
) and (
    max-height: 700px
) {
    .map-layer-control {
        top: clamp(9.5rem, 28vh, 12rem);
    }
}

/* Fine-tune floating Layers control spacing */
.map-layer-control {
    top: clamp(13.25rem, 27vh, 18rem);
}

@media (max-width: 700px) {
    .map-layer-control {
        top: clamp(14rem, 31vh, 19rem);
    }
}

@media (max-height: 700px) {
    .map-layer-control {
        top: clamp(11rem, 30vh, 14rem);
    }
}

@media (
    max-width: 700px
) and (
    max-height: 700px
) {
    .map-layer-control {
        top: clamp(11.75rem, 33vh, 14.75rem);
    }
}

.weather-current-panel {
    display: grid;
    gap: 0.65rem;
}

.weather-current-panel h3 {
    margin-bottom: 0;
}

.weather-forecast-disclosure {
    overflow: hidden;
    border: 1px solid #d3ccd8;
    border-radius: 0.65rem;
    background: #fff;
}

.weather-forecast-disclosure[hidden] {
    display: none;
}

.weather-forecast-disclosure summary {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.7rem 0.8rem;
    color: #3e3744;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
}

.weather-forecast-disclosure summary::-webkit-details-marker {
    display: none;
}

.weather-forecast-disclosure summary::after {
    content: "▾";
    margin-left: auto;
    color: #766d7d;
    transition: transform 150ms ease;
}

.weather-forecast-disclosure[open]
summary::after {
    transform: rotate(180deg);
}

.weather-forecast-disclosure summary:hover,
.weather-forecast-disclosure summary:focus-visible {
    background: #fff5dc;
}

.weather-forecast-panel {
    padding: 0 0.75rem 0.75rem;
}

.weather-forecast-panel[hidden] {
    display: none;
}

.astronomy-panel {
    display: grid;
    gap: 0.65rem;
}

.astronomy-panel h3,
.astronomy-panel p {
    margin-bottom: 0;
}

.sun-icon-key {
    display: flex;
    gap: 0.45rem;
    font-size: 1.2rem;
}

.sun-times-decorated {
    display: grid;
    gap: 0.45rem;
}

.sun-time-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sun-time-item > span:first-child {
    flex: 0 0 auto;
    font-size: 1.15rem;
}

.lunar-phase-result {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem;
    border: 1px solid #d3ccd8;
    border-radius: 0.65rem;
    background:
        linear-gradient(
            135deg,
            #f8f6fb,
            #eee9f4
        );
}

.lunar-phase-result > span:last-child {
    display: grid;
    gap: 0.15rem;
}

.lunar-phase-icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 2.5rem;
    height: 2.5rem;
    font-size: 2rem;
    line-height: 1;
}

#lunarPhaseText {
    color: #655d6b;
    font-size: 0.88rem;
}

@media (max-width: 520px) {
    .weather-forecast-disclosure summary {
        padding: 0.75rem;
    }

    .lunar-phase-result {
        align-items: flex-start;
    }
}

/* Sidebar top icon controls */
.sidebar-map-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    margin: 0 0 0.9rem;
    padding: 0.65rem;
    border-bottom: 1px solid #d8d1dc;
}

.sidebar-map-icon-button {
    display: grid;
    place-items: center;
    width: 2.8rem;
    min-width: 2.8rem;
    height: 2.8rem;
    min-height: 2.8rem;
    padding: 0.55rem;
    border: 1px solid #bbb5bf;
    border-radius: 0.65rem;
    background: #f2f1f3;
    color: #77717b;
}

.sidebar-map-icon-button:hover,
.sidebar-map-icon-button:focus-visible {
    border-color: #c58a1c;
    background: #fff7e5;
}

.sidebar-map-icon-button.active {
    border-color: #c58a1c;
    background: #fff3d2;
    color: #b87400;
}

.sidebar-map-icon-button:disabled {
    cursor: not-allowed;
    opacity: 0.4;
}

.sidebar-map-icon-button svg {
    display: block;
    width: 1.45rem;
    height: 1.45rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.85;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.fieldmarks-original-control-hidden {
    display: none !important;
}

/* Selected-location panel */
.sidebar-selected-location-panel {
    display: grid;
    gap: 0.7rem;
    margin-bottom: 1rem;
}

.sidebar-selected-location-panel[hidden] {
    display: none;
}

.sidebar-selected-location-panel > h2 {
    margin-top: 0;
}

.sidebar-selected-actions {
    display: grid;
    gap: 0.45rem;
}

.fieldmarks-user-hidden {
    display: none !important;
}

/* Settings checkbox rows */
.settings-checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
}

.settings-checkbox-row input {
    flex: 0 0 auto;
    width: auto;
    margin-top: 0.2rem;
}

/* Hide the emoji key above the sun information */
.sun-icon-key {
    display: none !important;
}

/* Replace emoji spans with reliable drawn symbols */
.sun-time-item > span:first-child {
    position: relative;
    display: inline-block;
    flex: 0 0 auto;
    width: 1.7rem;
    height: 1.35rem;
    overflow: visible;
    color: transparent;
    font-size: 0;
}

/* Sunrise: full sun sitting on a line */
.sun-time-item:first-child
> span:first-child::before {
    content: "";
    position: absolute;
    left: 0.43rem;
    top: 0.12rem;
    width: 0.75rem;
    height: 0.75rem;
    border: 2px solid #c47d00;
    border-radius: 50%;
    background: #ffc84d;
}

.sun-time-item:first-child
> span:first-child::after {
    content: "";
    position: absolute;
    left: 0.08rem;
    right: 0.08rem;
    bottom: 0.1rem;
    height: 2px;
    background: #87694a;
}

/* Sunset: half sun sitting on a line */
.sun-time-item:nth-child(2)
> span:first-child::before {
    content: "";
    position: absolute;
    left: 0.43rem;
    bottom: 0.1rem;
    width: 0.75rem;
    height: 0.38rem;
    border: 2px solid #c47d00;
    border-bottom: 0;
    border-radius:
        0.75rem 0.75rem 0 0;
    background: #ffc84d;
}

.sun-time-item:nth-child(2)
> span:first-child::after {
    content: "";
    position: absolute;
    left: 0.08rem;
    right: 0.08rem;
    bottom: 0.08rem;
    height: 2px;
    background: #87694a;
}

@media (max-width: 600px) {
    .sidebar-map-toolbar {
        position: sticky;
        top: 0;
        z-index: 5;
        background: inherit;
    }

    .sidebar-map-icon-button {
        width: 3rem;
        min-width: 3rem;
        height: 3rem;
        min-height: 3rem;
    }
}

html.fieldmarks-measuring
.fieldmarks-selected-popup {
    display: none !important;
}

/* Measurement result directly below icon row */
.sidebar-measurement-panel {
    display: grid;
    gap: 0.35rem;
    margin: -0.35rem 0 0.9rem;
    padding: 0.7rem 0.8rem;
    border: 1px solid #d3a21f;
    border-radius: 0.6rem;
    background: #fff3a8;
    color: #ad2525;
}

.sidebar-measurement-panel[hidden] {
    display: none;
}

.sidebar-measurement-panel p {
    margin: 0;
}

.measurement-distance-result {
    color: #a92121 !important;
    font-weight: 800;
}

.measurement-point-info {
    color: #a92121;
    font-size: 0.82rem;
    font-weight: 600;
}

/* Settings units */
.settings-distance-unit-row {
    display: grid;
    gap: 0.4rem;
    margin-top: 0.8rem;
}

.settings-distance-unit-row > span {
    font-weight: 700;
}

.settings-distance-unit-row select {
    width: 100%;
}

/* Shared framed sidebar panels */
.sidebar-framed-panel,
.sidebar-selected-location-panel,
.weather-current-panel,
.astronomy-panel {
    overflow: hidden;
    border: 1px solid #cbc6ce;
    border-radius: 0.65rem;
    background: #fff;
}

.sidebar-framed-panel {
    display: grid;
    gap: 0.65rem;
    margin-bottom: 1rem;
    padding: 0 0.75rem 0.75rem;
}

.sidebar-selected-location-panel {
    gap: 0.7rem;
    padding: 0 0.75rem 0.75rem;
}

.weather-current-panel,
.astronomy-panel {
    gap: 0.65rem;
    padding: 0 0.7rem 0.7rem;
}

/* Grey title bars */
.sidebar-framed-panel > h2,
.sidebar-selected-location-panel > h2,
.weather-current-panel > h3,
.astronomy-panel > h3 {
    margin:
        0 -0.75rem 0.15rem;
    padding: 0.62rem 0.75rem;
    border-bottom: 1px solid #cbc6ce;
    background: #e8e7e9;
    color: #39343c;
    font-size: 1rem;
    line-height: 1.25;
}

.weather-current-panel > h3,
.astronomy-panel > h3 {
    margin-left: -0.7rem;
    margin-right: -0.7rem;
    padding-left: 0.7rem;
    padding-right: 0.7rem;
}

/* Sunrise and sunset cards */
.sun-times-result {
    margin: 0;
}

.sun-times-decorated {
    display: grid;
    gap: 0.55rem;
}

.sun-time-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-height: 3.2rem;
    padding: 0.65rem 0.7rem;
    border: 1px solid #d3ccd8;
    border-radius: 0.65rem;
    background:
        linear-gradient(
            135deg,
            #f8f6fb,
            #eee9f4
        );
}

/* Match route-planner framed appearance */
#routePlannerPanel {
    border: 1px solid #cbc6ce;
    border-radius: 0.65rem;
}

#sidebarMapDataPanel[hidden],
.sidebar-framed-panel[hidden] {
    display: none;
}

@media (max-width: 600px) {
    .sidebar-measurement-panel {
        margin-top: -0.25rem;
    }
}

/* Four centred map-action icons */
.sidebar-map-toolbar {
    flex-wrap: wrap;
}

/* Measurement close button */
.sidebar-measurement-panel {
    position: relative;
    padding-right: 2.5rem;
}

.measurement-panel-close {
    position: absolute;
    top: 0.28rem;
    right: 0.35rem;
    display: grid;
    place-items: center;
    width: 1.75rem;
    min-width: 1.75rem;
    height: 1.75rem;
    min-height: 1.75rem;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #b11f27;
    font-size: 1.55rem;
    font-weight: 800;
    line-height: 1;
}

.measurement-panel-close:hover,
.measurement-panel-close:focus-visible {
    background: rgba(177, 31, 39, 0.12);
    color: #86151b;
}

/* Route Planner displayed below toolbar */
.sidebar-route-planner-panel {
    display: grid;
    gap: 0.65rem;
    margin: -0.35rem 0 0.9rem;
    padding: 0.75rem;
    border: 1px solid #cbc6ce;
    border-radius: 0.65rem;
    background: #fff;
}

.sidebar-route-planner-panel[hidden] {
    display: none;
}

.sidebar-route-planner-panel
#routePlannerControls {
    display: grid;
    gap: 0.6rem;
}

.sidebar-route-planner-panel
#routePlannerControls[hidden] {
    display: none;
}

/* Your Map Data contents */
#sidebarMapDataPanel
.map-data-subheading {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: #554f58;
    font-size: 0.9rem;
}

#sidebarMapDataPanel > p,
#sidebarMapDataPanel > label {
    margin: 0;
}

#sidebarMapDataPanel
.fieldmarks-original-control-hidden {
    display: none !important;
}

@media (max-width: 420px) {
    .sidebar-map-toolbar {
        gap: 0.45rem;
    }

    .sidebar-map-icon-button {
        width: 2.75rem;
        min-width: 2.75rem;
        height: 2.75rem;
        min-height: 2.75rem;
    }
}

/* Keep every Route Planner control inside its panel */
.sidebar-route-planner-panel,
.sidebar-route-planner-panel *,
.sidebar-route-planner-panel *::before,
.sidebar-route-planner-panel *::after {
    box-sizing: border-box;
}

.sidebar-route-planner-panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.sidebar-route-planner-panel
#routePlannerControls {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.sidebar-route-planner-panel label {
    display: grid;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    gap: 0.35rem;
}

.sidebar-route-planner-panel input,
.sidebar-route-planner-panel select,
.sidebar-route-planner-panel textarea,
.sidebar-route-planner-panel button {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-right: 0;
    margin-left: 0;
}

.sidebar-route-planner-panel input[type="file"] {
    overflow: hidden;
    font-size: 0.82rem;
}

.sidebar-route-planner-panel textarea {
    resize: vertical;
    overflow-wrap: anywhere;
}

.sidebar-route-planner-panel
.route-planner-summary {
    width: 100%;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.sidebar-route-planner-panel
.saved-content-photo-preview {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.sidebar-route-planner-panel
.saved-content-photo-preview img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
}

@media (max-width: 600px) {
    .sidebar-route-planner-panel {
        padding: 0.65rem;
    }
}

/* Hide the old unstyled status paragraph */
.fieldmarks-status-source-hidden {
    display: none !important;
}

/* Configurable FieldMarks status notification */
.fieldmarks-status-toast {
    position: absolute;
    z-index: 80;
    width: max-content;
    max-width:
        min(34rem, calc(100% - 2rem));
    padding: 0.55rem 0.85rem;
    border: 1px solid
        rgba(115, 96, 38, 0.42);
    border-radius: 0.55rem;
    background:
        rgba(255, 249, 218, 0.96);
    color: #6f2727;
    box-shadow:
        0 5px 18px
        rgba(30, 24, 34, 0.2);
    font-size: 0.84rem;
    font-weight: 650;
    line-height: 1.35;
    text-align: center;
    overflow-wrap: anywhere;
    pointer-events: none;
    opacity: 0;
    transform:
        translate(-50%, -0.35rem);
    transition:
        opacity 160ms ease,
        transform 160ms ease;
}

.fieldmarks-status-toast[hidden] {
    display: none;
}

.fieldmarks-status-toast.visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.fieldmarks-status-toast.position-top {
    top: 1rem;
    left: 50%;
}

.fieldmarks-status-toast.position-middle {
    top: 50%;
    left: 50%;
    transform:
        translate(-50%, calc(-50% - 0.35rem));
}

.fieldmarks-status-toast.position-middle.visible {
    transform: translate(-50%, -50%);
}

.fieldmarks-status-toast.position-bottom {
    bottom: 1rem;
    left: 50%;
}

.fieldmarks-status-toast.position-sidebar {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    left: 50%;
    width: calc(100% - 1rem);
    max-width: none;
    margin: 0.75rem 0 0.25rem;
}

.fieldmarks-status-toast.position-sidebar.visible {
    transform: translate(-50%, 0);
}

/* Settings subsection */
.settings-subsection {
    display: grid;
    gap: 0.7rem;
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid #d4ced7;
}

.settings-subsection h3 {
    margin: 0;
}

.settings-subsection label {
    display: grid;
    gap: 0.35rem;
}

.settings-subsection select {
    width: 100%;
    max-width: 100%;
}

@media (max-width: 600px) {
    .fieldmarks-status-toast {
        max-width: calc(100% - 1rem);
        font-size: 0.8rem;
    }

    .fieldmarks-status-toast.position-top {
        top: 0.6rem;
    }

    .fieldmarks-status-toast.position-bottom {
        bottom: 0.6rem;
    }
}

.app-shell {
    position: relative;
}

#map {
    position: relative;
}

/* Selected-location MWIS card */
.selected-location-mwis {
    display: grid;
    gap: 0.6rem;
    margin-top: 0.7rem;
    padding: 0.7rem;
    border: 1px solid #c9c4cc;
    border-radius: 0.65rem;
    background:
        linear-gradient(
            135deg,
            #f4f3f5,
            #e9e7eb
        );
}

.selected-location-mwis[hidden] {
    display: none;
}

.selected-location-mwis-heading {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.selected-location-mwis-icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: #fff3d2;
    color: #a86800;
}

.selected-location-mwis-icon svg {
    width: 1.25rem;
    height: 1.25rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.selected-location-mwis p {
    margin: 0;
}

.selected-location-mwis button {
    width: 100%;
    max-width: 100%;
}

.selected-location-mwis-notice {
    color: #655e68;
    font-size: 0.76rem;
    line-height: 1.4;
}

/* Popup MWIS icon */
#selectedPopupMwis {
    color: #a86800;
}

/* MWIS Settings */
.mwis-settings-section {
    display: grid;
    gap: 0.8rem;
}

.mwis-settings-section > h3 {
    margin-bottom: 0;
}

.mwis-settings-notice {
    padding: 0.65rem;
    border: 1px solid #d7c77b;
    border-radius: 0.55rem;
    background: #fff8d9;
}

.mwis-settings-fields {
    display: grid;
    gap: 0.85rem;
}

.mwis-settings-region {
    display: grid;
    gap: 0.35rem;
    padding: 0.65rem;
    border: 1px solid #d3ced6;
    border-radius: 0.55rem;
    background: #f8f7f9;
}

.mwis-settings-region > span:first-child {
    display: grid;
    gap: 0.1rem;
}

.mwis-settings-region input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.mwis-settings-region input.invalid {
    border-color: #b2222c;
    outline:
        2px solid rgba(178, 34, 44, 0.17);
}

.mwis-settings-region small {
    overflow-wrap: anywhere;
}

.mwis-default-url {
    color: #706873;
}

.mwis-url-error {
    color: #a51e27;
    font-weight: 700;
}

.mwis-settings-actions {
    display: grid;
    grid-template-columns:
        minmax(0, 1fr)
        minmax(0, 1fr);
    gap: 0.6rem;
}

.mwis-settings-actions button {
    width: 100%;
    max-width: 100%;
}

@media (max-width: 600px) {
    .mwis-settings-actions {
        grid-template-columns: 1fr;
    }

    .mwis-settings-region {
        padding: 0.55rem;
    }
}

/* Stable external-link action in selected marker popup */
.selected-popup-external-link {
    display: grid;
    place-items: center;
    box-sizing: border-box;
    text-decoration: none;
    cursor: pointer;
}

.selected-popup-external-link:visited {
    color: inherit;
}

.selected-popup-external-link:hover,
.selected-popup-external-link:focus-visible {
    text-decoration: none;
}

/* MWIS is now a native popup button */
#selectedPopupMwis {
    display: grid;
    place-items: center;
    cursor: pointer;
}

#selectedPopupMwis svg {
    pointer-events: none;
}

#selectedPopupMwis
.selected-popup-tooltip {
    pointer-events: none;
}

/* Collapsible FieldMarks sidebar */
.sidebar {
    transition:
        width 220ms ease,
        min-width 220ms ease,
        max-width 220ms ease,
        flex-basis 220ms ease,
        padding 220ms ease,
        opacity 160ms ease;
}

/* Arrow attached to the outside edge of the menu */
.fieldmarks-sidebar-toggle {
    position: fixed;
    z-index: 110;
    display: grid;
    place-items: center;
    width: 2rem;
    min-width: 2rem;
    height: 2.75rem;
    min-height: 2.75rem;
    margin: 0;
    padding: 0;
    border: 1px solid #bcb6c0;
    border-left-width: 0;
    border-radius: 0 0.55rem 0.55rem 0;
    background: rgba(255, 255, 255, 0.97);
    color: #504a53;
    box-shadow:
        3px 2px 9px
        rgba(31, 27, 34, 0.16);
    cursor: pointer;
    transition:
        left 220ms ease,
        background 120ms ease,
        color 120ms ease;
}

.fieldmarks-sidebar-toggle:hover,
.fieldmarks-sidebar-toggle:focus-visible {
    background: #f0edf2;
    color: #251f28;
}

.fieldmarks-sidebar-toggle svg {
    width: 1.15rem;
    height: 1.15rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

/*
 * Collapse the sidebar completely so the map expands
 * into the space previously occupied by the menu.
 */
body.fieldmarks-sidebar-is-collapsed
.sidebar {
    flex: 0 0 0 !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border-width: 0 !important;
    overflow: hidden !important;
    opacity: 0;
    pointer-events: none;
}

/*
 * Support layouts where app-shell uses a two-column
 * CSS grid rather than flexbox.
 */
body.fieldmarks-sidebar-is-collapsed
.app-shell {
    grid-template-columns:
        0 minmax(0, 1fr) !important;
}

/* Top toolbar remains visible over the map */
#sidebarMapToolbar.fieldmarks-floating-toolbar {
    position: fixed !important;
    z-index: 105;
    top:
        var(
            --fieldmarks-floating-toolbar-top,
            5rem
        ) !important;
    left:
        var(
            --fieldmarks-floating-toolbar-left,
            0.75rem
        ) !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    width: max-content !important;
    max-width: calc(100vw - 4rem) !important;
    margin: 0 !important;
    padding: 0.4rem !important;
    border: 1px solid
        rgba(132, 124, 136, 0.6);
    border-radius: 0.7rem;
    background:
        rgba(255, 255, 255, 0.96);
    box-shadow:
        0 5px 18px
        rgba(29, 25, 32, 0.2);
    opacity: 1 !important;
    pointer-events: auto !important;
    overflow-x: auto;
    overscroll-behavior: contain;
}

/*
 * Keep the floating icon controls at their original
 * compact size rather than stretching across the map.
 */
#sidebarMapToolbar.fieldmarks-floating-toolbar
button,
#sidebarMapToolbar.fieldmarks-floating-toolbar
a {
    flex: 0 0 auto;
}

/* Prevent the map canvas being covered by stale widths */
body.fieldmarks-sidebar-is-collapsed
#map {
    width: 100% !important;
}

/* Mobile positioning */
@media (max-width: 700px) {
    #sidebarMapToolbar.fieldmarks-floating-toolbar {
        top: 0.55rem !important;
        left: 0.55rem !important;
        max-width: calc(100vw - 3.7rem) !important;
    }

    .fieldmarks-sidebar-toggle {
        width: 1.85rem;
        min-width: 1.85rem;
        height: 2.55rem;
        min-height: 2.55rem;
    }
}

/* Compact place-search control */
header input[type="search"],
.app-header input[type="search"],
.top-bar input[type="search"],
#placeSearch,
#placeSearchInput,
#locationSearch,
#searchPlace {
    box-sizing: border-box;
    width: clamp(9rem, 18vw, 15rem);
    max-width: 15rem;
    height: 2rem;
    min-height: 2rem;
    padding: 0.22rem 0.65rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    line-height: 1.15;
}

/*
 * Also reduce the surrounding form where the search
 * field is placed inside a wider flex container.
 */
header form:has(input[type="search"]),
.app-header form:has(input[type="search"]),
.top-bar form:has(input[type="search"]) {
    flex: 0 1 15rem;
    width: auto;
    max-width: 15rem;
    min-width: 9rem;
}

/* Keep the search button compact if one is present */
header form:has(input[type="search"]) button,
.app-header form:has(input[type="search"]) button,
.top-bar form:has(input[type="search"]) button {
    min-height: 2rem;
    height: 2rem;
    padding-top: 0.2rem;
    padding-bottom: 0.2rem;
}

/* Compact icon-only header controls */
.fieldmarks-header-icon-button {
    position: relative;
    display: inline-grid !important;
    place-items: center;
    flex: 0 0 auto;
    box-sizing: border-box;
    width: 2.5rem !important;
    min-width: 2.5rem !important;
    max-width: 2.5rem !important;
    height: 2.5rem !important;
    min-height: 2.5rem !important;
    max-height: 2.5rem !important;
    padding: 0.45rem !important;
    overflow: visible;
}

.fieldmarks-header-icon-button > svg {
    display: block;
    width: 1.45rem;
    height: 1.45rem;
    flex: none;
    fill: currentColor;
    stroke: none;
    pointer-events: none;
}

/* Outlined system icons */
.fieldmarks-settings-icon > svg,
.fieldmarks-map-refresh-icon > svg,
.fieldmarks-sign-out-icon > svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Filled supplied route/location icons */
.fieldmarks-my-routes-icon > svg,
.fieldmarks-my-locations-icon > svg {
    fill: currentColor;
    stroke: none;
}

/* Accessible hover labels */
.fieldmarks-header-tooltip {
    position: absolute;
    z-index: 160;
    top: calc(100% + 0.45rem);
    left: 50%;
    width: max-content;
    max-width: 14rem;
    padding: 0.3rem 0.48rem;
    border-radius: 0.35rem;
    background: rgba(30, 27, 32, 0.96);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform:
        translate(-50%, -0.2rem);
    transition:
        opacity 120ms ease,
        transform 120ms ease,
        visibility 120ms ease;
}

.fieldmarks-header-icon-button:hover
.fieldmarks-header-tooltip,
.fieldmarks-header-icon-button:focus-visible
.fieldmarks-header-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

@media (max-width: 700px) {
    header input[type="search"],
    .app-header input[type="search"],
    .top-bar input[type="search"],
    #placeSearch,
    #placeSearchInput,
    #locationSearch,
    #searchPlace {
        width: clamp(7rem, 34vw, 11rem);
        max-width: 11rem;
    }

    header form:has(input[type="search"]),
    .app-header form:has(input[type="search"]),
    .top-bar form:has(input[type="search"]) {
        flex-basis: 11rem;
        max-width: 11rem;
        min-width: 7rem;
    }

    .fieldmarks-header-icon-button {
        width: 2.35rem !important;
        min-width: 2.35rem !important;
        max-width: 2.35rem !important;
        height: 2.35rem !important;
        min-height: 2.35rem !important;
        max-height: 2.35rem !important;
        padding: 0.42rem !important;
    }

    .fieldmarks-header-icon-button > svg {
        width: 1.35rem;
        height: 1.35rem;
    }
}

/* Allow centred search and visible tooltips */
header,
.app-header,
.top-bar {
    position: relative;
    overflow: visible !important;
}

/*
 * Centre the complete search form relative to the
 * header, independently of the logo and right controls.
 */
header form:has(input[type="search"]),
.app-header form:has(input[type="search"]),
.top-bar form:has(input[type="search"]) {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 4;
    display: flex !important;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap !important;
    gap: 0.35rem;
    width: min(24rem, 38vw);
    max-width: min(24rem, 38vw);
    min-width: 13rem;
    margin: 0 !important;
    transform: translate(-50%, -50%);
}

/* Thinner and shorter search field */
header form:has(input[type="search"])
input[type="search"],
.app-header form:has(input[type="search"])
input[type="search"],
.top-bar form:has(input[type="search"])
input[type="search"] {
    flex: 1 1 auto;
    box-sizing: border-box;
    width: auto !important;
    min-width: 0;
    max-width: none !important;
    height: 1.95rem !important;
    min-height: 1.95rem !important;
    margin: 0 !important;
    padding: 0.2rem 0.62rem !important;
    font-size: 0.84rem;
    line-height: 1.1;
}

/* Search submit remains directly alongside the input */
header form:has(input[type="search"])
button[type="submit"],
.app-header form:has(input[type="search"])
button[type="submit"],
.top-bar form:has(input[type="search"])
button[type="submit"] {
    display: inline-grid !important;
    place-items: center;
    flex: 0 0 auto;
    box-sizing: border-box;
    width: auto !important;
    min-width: 4rem;
    height: 1.95rem !important;
    min-height: 1.95rem !important;
    margin: 0 !important;
    padding: 0.2rem 0.65rem !important;
    white-space: nowrap;
}

/* Reliable header hover labels */
.fieldmarks-header-icon-button {
    position: relative;
    overflow: visible !important;
}

.fieldmarks-header-icon-button::after {
    content:
        attr(data-fieldmarks-tooltip);
    position: absolute;
    z-index: 500;
    top: calc(100% + 0.42rem);
    left: 50%;
    width: max-content;
    max-width: 14rem;
    padding: 0.32rem 0.5rem;
    border-radius: 0.35rem;
    background: rgba(30, 27, 32, 0.97);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 650;
    line-height: 1.2;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform:
        translate(-50%, -0.2rem);
    transition:
        opacity 120ms ease,
        transform 120ms ease,
        visibility 120ms ease;
}

.fieldmarks-header-icon-button:hover::after,
.fieldmarks-header-icon-button:focus-visible::after {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

/* Remove the earlier nested tooltip */
.fieldmarks-header-tooltip {
    display: none !important;
}

/* Explorer is an outlined icon */
.fieldmarks-explorer-icon > svg {
    fill: none !important;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Improved cog treatment */
.fieldmarks-settings-icon-v2 > svg {
    fill: none !important;
    stroke: currentColor;
    stroke-width: 1.65;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/*
 * On narrower screens, keep the search in the header
 * flow so it cannot overlap the logo or control icons.
 */
@media (max-width: 900px) {
    header form:has(input[type="search"]),
    .app-header form:has(input[type="search"]),
    .top-bar form:has(input[type="search"]) {
        position: static;
        width: min(19rem, 42vw);
        max-width: min(19rem, 42vw);
        min-width: 10rem;
        transform: none;
    }
}

@media (max-width: 650px) {
    header form:has(input[type="search"]),
    .app-header form:has(input[type="search"]),
    .top-bar form:has(input[type="search"]) {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        order: 20;
    }
}

/*
 * JavaScript controls normal visibility, while hidden
 * ensures the arrow can never remain as a floating
 * control over Routes, Locations or Explorer.
 */
#fieldmarksSidebarToggle[hidden] {
    display: none !important;
}

#fieldmarksSidebarToggle[hidden] {
    display: none !important;
}

/*
 * This overrides inline display values and hidden-state
 * changes made by the existing sidebar functions.
 */
body.fieldmarks-non-map-screen
#fieldmarksSidebarToggle {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Sun, Moon and Tides panel */
.tide-information-panel {
    margin-top: 0.9rem;
    padding-top: 0.9rem;
    border-top: 1px solid
        rgba(110, 103, 115, 0.3);
}

.tide-information-panel h4 {
    margin:
        0 0 0.55rem;
    font-size: 0.98rem;
}

.tide-information-result {
    margin: 0;
    padding: 0.65rem;
    border-radius: 0.55rem;
    background:
        rgba(229, 238, 246, 0.65);
}

.tide-information-result p {
    margin:
        0 0 0.42rem;
}

.tide-information-result p:last-child {
    margin-bottom: 0;
}

.tide-information-result.loading {
    opacity: 0.78;
}

.tide-information-result.tide-not-near-coast {
    font-weight: 650;
    text-align: center;
    background:
        rgba(235, 235, 235, 0.72);
}

.tide-information-result.error {
    background:
        rgba(255, 232, 226, 0.82);
}

.tide-navigation-warning {
    margin:
        0.65rem 0 0;
    padding:
        0.5rem 0.6rem;
    border-left:
        4px solid #b64235;
    background:
        rgba(255, 232, 226, 0.76);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.35;
}

.tide-limitations {
    margin-top: 0.55rem;
    font-size: 0.78rem;
}

.tide-limitations summary {
    cursor: pointer;
    font-weight: 650;
}

.tide-limitations p {
    margin:
        0.45rem 0 0;
    line-height: 1.4;
}

/* Tide distance Settings */
.tide-distance-settings {
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid
        rgba(110, 103, 115, 0.28);
}

.tide-distance-settings h4 {
    margin:
        0 0 0.65rem;
}

.tide-distance-setting-control {
    display: grid;
    grid-template-columns:
        minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.7rem;
    margin-top: 0.45rem;
}

#tideCoastDistanceSetting {
    width: 100%;
}

#tideCoastDistanceValue {
    min-width: 4.8rem;
    padding:
        0.25rem 0.4rem;
    border-radius: 0.35rem;
    background:
        rgba(230, 230, 230, 0.8);
    font-weight: 700;
    text-align: center;
}
