#safdem_editor .inside {
    margin: 0;
    padding: 0;
}

.safdem-editor {
    background: #f8fafc;
    color: #1f2937;
    position: relative;
}

.safdem-editor__toolbar {
    align-items: center;
    background: #fff;
    border-bottom: 1px solid #dcdcde;
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 10px 12px;
}

.safdem-file-button {
    position: relative;
}

.safdem-save-hint {
    color: #646970;
    font-size: 12px;
    margin-left: auto;
}

.safdem-lock-hint {
    border-radius: 999px;
    font-size: 12px;
    font-weight: 650;
    padding: 3px 8px;
}

.safdem-lock-hint[data-state="checking"] {
    background: #f0f6fc;
    color: #135e96;
}

.safdem-lock-hint[data-state="owned"] {
    background: #edfaef;
    color: #06752f;
}

.safdem-lock-hint[data-state="locked"] {
    background: #fcf0f1;
    color: #b32d2e;
}

.safdem-lock-screen[hidden] {
    display: none !important;
}

.safdem-lock-screen {
    align-items: center;
    background: rgba(241, 245, 249, 0.93);
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 24px;
    position: absolute;
    z-index: 2000;
}

.safdem-lock-screen__card {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 8px;
    box-shadow: 0 12px 35px rgba(15, 23, 42, 0.22);
    max-width: 520px;
    padding: 24px;
    text-align: center;
    width: 100%;
}

.safdem-lock-screen__card h3 {
    font-size: 20px;
    margin: 4px 0 10px;
}

.safdem-lock-screen__card p {
    font-size: 14px;
    line-height: 1.55;
    margin: 0 0 16px;
}

.safdem-lock-screen .spinner {
    animation: safdem-spin 0.8s linear infinite;
    border: 3px solid #dcdcde;
    border-radius: 50%;
    border-top-color: #2271b1;
    display: inline-block;
    float: none;
    height: 24px;
    margin: 0 0 8px;
    opacity: 1;
    visibility: visible;
    width: 24px;
}

.safdem-lock-screen .spinner[hidden] {
    display: none !important;
}

@keyframes safdem-spin {
    to { transform: rotate(360deg); }
}

.safdem-editor.is-awaiting-lock .safdem-editor__body,
.safdem-editor.is-awaiting-lock .safdem-editor__toolbar > :not([data-safdem-lock-status]):not([data-safdem-save-status]) {
    pointer-events: none;
    user-select: none;
}

.safdem-editor__body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 390px;
    min-height: 760px;
}

.safdem-map-column {
    min-width: 0;
    position: relative;
}

.safdem-map {
    height: 720px;
    width: 100%;
    z-index: 1;
}

.safdem-map.is-placing {
    cursor: crosshair;
}

.safdem-coordinate-bar {
    align-items: center;
    background: #111827;
    color: #f9fafb;
    display: flex;
    font-size: 12px;
    gap: 15px;
    justify-content: space-between;
    min-height: 40px;
    padding: 5px 11px;
}

.safdem-coordinate-bar [data-safdem-mode-status] {
    color: #fbbf24;
    font-weight: 650;
    text-align: right;
}

.safdem-sidebar {
    background: #fff;
    border-left: 1px solid #dcdcde;
    max-height: 760px;
    overflow: auto;
}

.safdem-tabs {
    background: #f0f0f1;
    border-bottom: 1px solid #c3c4c7;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: sticky;
    top: 0;
    z-index: 20;
}

.safdem-version-label {
    display: flex;
    flex-direction: column;
    font-size: 12px;
    font-weight: 650;
    gap: 5px;
    margin-top: 12px;
}

.safdem-version-label input {
    width: 100%;
}

.safdem-branch-summary {
    background: #f0f6fc;
    border-left: 4px solid #2271b1;
    display: flex;
    flex-direction: column;
    font-size: 12px;
    gap: 2px;
    margin: 10px 0;
    padding: 9px 10px;
}

.safdem-version-status {
    font-size: 12px;
    min-height: 18px;
}

.safdem-version-status[data-state="success"] {
    color: #06752f;
    font-weight: 650;
}

.safdem-version-status[data-state="error"] {
    color: #b32d2e;
    font-weight: 650;
}

.safdem-version-status[data-state="working"] {
    color: #135e96;
    font-weight: 650;
}

.safdem-version-list {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}

.safdem-version-card {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 5px;
    padding: 10px;
}

.safdem-version-card header {
    align-items: center;
    display: flex;
    gap: 8px;
    justify-content: space-between;
}

.safdem-version-card__label {
    font-weight: 650;
    margin-top: 6px;
}

.safdem-version-card__reason,
.safdem-version-card__meta {
    color: #646970;
    font-size: 11px;
    margin-top: 3px;
}

.safdem-version-current {
    background: #edfaef;
    border-radius: 999px;
    color: #06752f;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
}

.safdem-version-card .safdem-button-row {
    margin: 9px 0 0;
}

.safdem-version-forks {
    border-top: 1px solid #dcdcde;
    display: flex;
    flex-direction: column;
    font-size: 11px;
    gap: 3px;
    margin-top: 9px;
    padding-top: 8px;
}

.safdem-fork-result[hidden] {
    display: none !important;
}

.safdem-fork-result {
    background: #edfaef;
    border: 1px solid #9ad5a5;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin: 10px 0;
    padding: 10px;
}

.safdem-fork-result label {
    display: flex;
    flex-direction: column;
    font-size: 11px;
    font-weight: 650;
    gap: 3px;
}

.safdem-fork-result input {
    font-family: monospace;
    width: 100%;
}

.safdem-tab {
    background: transparent;
    border: 0;
    border-bottom: 3px solid transparent;
    color: #3c434a;
    cursor: pointer;
    font-weight: 650;
    padding: 11px 5px 9px;
}

.safdem-tab:hover,
.safdem-tab:focus {
    background: #fff;
    color: #135e96;
}

.safdem-tab.is-active {
    background: #fff;
    border-bottom-color: #2271b1;
    color: #135e96;
}

.safdem-tab-panel {
    padding: 14px;
}

.safdem-tab-panel h3 {
    font-size: 15px;
    margin: 2px 0 6px;
}

.safdem-tab-panel hr {
    border: 0;
    border-top: 1px solid #dcdcde;
    margin: 20px 0;
}

.safdem-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 10px 0 14px;
}

.safdem-form-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: 1fr 1fr;
    margin: 10px 0 13px;
}

.safdem-form-grid label {
    color: #3c434a;
    display: flex;
    flex-direction: column;
    font-size: 12px;
    font-weight: 650;
    gap: 4px;
    min-width: 0;
}

.safdem-form-grid input:not([type="checkbox"]):not([type="range"]):not([type="color"]),
.safdem-form-grid select,
.safdem-form-grid textarea {
    font-weight: 400;
    max-width: 100%;
    width: 100%;
}

.safdem-form-grid input[type="color"] {
    height: 34px;
    padding: 2px;
    width: 100%;
}

.safdem-form-grid input[type="range"] {
    width: 100%;
}

.safdem-span-2 {
    grid-column: 1 / -1;
}

.safdem-form-grid .safdem-check {
    align-items: center;
    display: flex;
    flex-direction: row;
    font-weight: 500;
}

.safdem-media-row {
    display: flex;
    gap: 5px;
}

.safdem-media-row input {
    min-width: 0;
}

.safdem-full-button {
    justify-content: center;
    text-align: center;
    width: 100%;
}

.safdem-button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 8px 0 18px;
}

.safdem-measurements,
.safdem-summary {
    background: #f8fafc;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    font-size: 12px;
    margin-top: 8px;
    padding: 7px 10px;
}

.safdem-w3w-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 9px;
}

.safdem-w3w-actions span {
    color: #50575e;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.safdem-editor .leaflet-control-container {
    font-size: 12px;
}

.safdem-editor .leaflet-top,
.safdem-editor .leaflet-bottom {
    z-index: 500;
}

@media (max-width: 1180px) {
    .safdem-editor__body {
        grid-template-columns: 1fr;
    }

    .safdem-sidebar {
        border-left: 0;
        border-top: 1px solid #dcdcde;
        max-height: none;
    }

    .safdem-map {
        height: 620px;
    }
}

@media (max-width: 782px) {
    .safdem-save-hint,
    .safdem-lock-hint {
        margin-left: 0;
        width: 100%;
    }

    .safdem-tabs {
        grid-template-columns: repeat(2, 1fr);
    }

    .safdem-map {
        height: 520px;
    }

    .safdem-form-grid {
        grid-template-columns: 1fr;
    }

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

/* Shared manual-save/autosave state indicators. */
.safdem-editor [data-safdem-save-status][data-state="dirty"] {
    color: #996800;
    font-weight: 650;
}

.safdem-editor [data-safdem-save-status][data-state="saving"] {
    color: #135e96;
    font-weight: 650;
}

.safdem-editor [data-safdem-save-status][data-state="saved"] {
    color: #06752f;
    font-weight: 650;
}

.safdem-editor [data-safdem-save-status][data-state="error"] {
    color: #b32d2e;
    font-weight: 650;
}

.safdem-editor.has-unsaved-changes {
    box-shadow: inset 0 3px 0 #dba617;
}

/* Per-map advanced editor access controls. */
#safdem_access .inside {
    margin-top: 0;
}

.safdem-access-field {
    border-top: 1px solid #dcdcde;
    margin-top: 14px;
    padding-top: 14px;
}

.safdem-access-field > label {
    display: block;
    margin-bottom: 6px;
}

.safdem-access-field select[multiple] {
    min-height: 150px;
    width: 100%;
}

.safdem-access-note {
    border-top: 1px solid #dcdcde;
    margin-top: 14px !important;
    padding-top: 12px;
}
