.navbar-custom {
    position: relative;
    z-index: 1000;
}

.route-editor-wrap {
    width: 80%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0.75rem 1rem 2rem;
}

.route-editor-head h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 0.35rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.route-editor-head p {
    color: #6c757d;
    margin-bottom: 1rem;
}

.route-editor-toolbar,
.route-editor-maptools {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

.route-editor-maptools {
    margin-bottom: 0.45rem;
}

.route-editor-toolbar input[type="text"],
.route-editor-toolbar input[type="number"],
.route-editor-toolbar select,
.route-editor-maptools input[type="text"],
.route-editor-maptools select {
    height: 36px;
    border: 1px solid #d9d6e3;
    border-radius: 8px;
    padding: 0 0.7rem;
    background: #fff;
}

.route-editor-toolbar input[type="text"] {
    min-width: 180px;
    flex: 1 1 180px;
}

.route-editor-maptools input[type="text"] {
    min-width: 180px;
    flex: 1 1 160px;
}

.route-editor-maptools input[type="number"] {
    width: 88px;
    height: 36px;
    border: 1px solid #d9d6e3;
    border-radius: 8px;
    padding: 0 0.7rem;
    background: #fff;
}

.re-aid-unit {
    color: #475569;
    font-size: 0.92rem;
}

.route-editor-toolbar input[type="number"] {
    width: 150px;
}

.re-btn {
    height: 36px;
    border-radius: 8px;
    border: 1px solid #d9d6e3;
    background: #fff;
    padding: 0 0.8rem;
    cursor: pointer;
    color: #343a40;
}

.re-btn:hover {
    border-color: #667eea;
    color: #4c51bf;
}

.re-btn.is-on,
.re-btn-primary {
    background: #667eea;
    border-color: #667eea;
    color: #fff;
}

.re-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.route-editor-status {
    flex: 1 1 220px;
    min-height: 36px;
    display: flex;
    align-items: center;
    color: #495057;
    font-size: 0.92rem;
}

.route-editor-status.is-error {
    color: #b91c1c;
}

.route-editor-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

#route-map {
    height: calc(100vh - 190px);
    min-height: 560px;
    width: 100%;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    background: #e7e5ef;
    z-index: 1;
}

#route-map.is-drawing {
    cursor: crosshair;
}

.route-editor-side {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    padding: 1rem;
}

.route-editor-side h2 {
    font-size: 1rem;
    margin: 0 0 0.75rem;
}

.re-stats {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.55rem;
    margin-bottom: 0.9rem;
}

.re-stat {
    background: #faf7fb;
    border-radius: 10px;
    padding: 0.55rem 0.7rem;
}

.re-stat span {
    display: block;
    color: #6c757d;
    font-size: 0.78rem;
}

.re-stat strong {
    font-size: 1.05rem;
}

.re-chart-box {
    position: relative;
    height: 170px;
    margin-bottom: 0.75rem;
}

.re-empty {
    color: #6c757d;
    font-size: 0.85rem;
    margin: 0 0 0.75rem;
}

.re-saved-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.4rem;
}

.re-saved-list,
.re-point-list {
    list-style: none;
    margin: 0.4rem 0 0;
    padding: 0;
    max-height: 220px;
    overflow: auto;
}

.re-saved-item,
.re-point-item {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    padding: 0.4rem 0;
    border-top: 1px solid #f1eef6;
}

.re-saved-item button.re-load,
.re-point-item button.re-focus {
    flex: 1;
    text-align: left;
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
}

.re-saved-item small,
.re-point-item small {
    display: block;
    color: #6c757d;
}

.re-saved-item.is-active {
    background: #f5f3ff;
    border-radius: 8px;
    padding-left: 0.45rem;
    padding-right: 0.45rem;
}

.re-saved-actions {
    display: flex;
    gap: 0.65rem;
    flex: none;
}

.re-linkish {
    border: 0;
    background: transparent;
    color: #b91c1c;
    cursor: pointer;
    padding: 0;
    white-space: nowrap;
}

.re-linkish.re-edit {
    color: #6d28d9;
    font-weight: 700;
}

.re-route-hit {
    cursor: pointer;
}

.re-divicon {
    background: transparent !important;
    border: 0 !important;
}

.re-pin {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.re-pin.is-selected {
    outline: 3px solid #111827;
}

.re-pin.is-wide {
    width: 40px;
    border-radius: 14px;
    font-size: 10px;
}

.re-start { background: #16a34a; }
.re-finish { background: #dc2626; }
.re-water { background: #2563eb; }
.re-aid { background: #0284c7; }
.re-medical { background: #b91c1c; }
.re-toilet { background: #57534e; }
.re-turn { background: #d97706; }
.re-uturn { background: #c2410c; }
.re-checkpoint { background: #7c3aed; }
.re-km { background: #111827; }
.re-node { background: #667eea; }
.re-insert {
    width: 22px;
    height: 22px;
    background: #fff;
    color: #6d28d9;
    border: 2px solid #6d28d9;
    font-size: 16px;
    line-height: 1;
    box-shadow: 0 1px 4px rgba(109, 40, 217, 0.35);
}
.re-half { background: #0f766e; }

.re-join {
    position: fixed;
    inset: 0;
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 23, 42, 0.45);
}

.re-join[hidden] {
    display: none;
}

.re-join-card {
    width: min(440px, 100%);
    background: #fff;
    border-radius: 16px;
    padding: 1.25rem 1.3rem 1.1rem;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}

.re-join-card h2 {
    margin: 0 0 0.45rem;
    font-size: 1.25rem;
}

.re-join-card p {
    margin: 0;
    color: #475569;
    line-height: 1.55;
}

.re-join-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}

.re-osm-note {
    color: #868e96;
    font-size: 0.75rem;
    margin-top: 0.8rem;
}

@media (max-width: 720px) {
    .route-editor-wrap {
        width: 100%;
    }
    .re-stats {
        grid-template-columns: 1fr 1fr;
    }
    #route-map {
        height: 70vh;
        min-height: 420px;
    }
}
