* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body, html {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a2e;
    color: #e0e0e0;
}

#app {
    display: flex;
    height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */

#sidebar {
    width: 260px;
    min-width: 260px;
    display: flex;
    flex-direction: column;
    background: #16213e;
    border-right: 1px solid #0f3460;
    overflow: hidden;
}

#sidebar-header {
    padding: 14px 14px 12px;
    background: #0f3460;
    flex-shrink: 0;
}

h1 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #e94560;
    margin-bottom: 10px;
    text-transform: uppercase;
}

#search-box {
    display: flex;
    gap: 6px;
}

#postcode {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid #1a2a50;
    border-radius: 5px;
    background: #1a1a2e;
    color: #e0e0e0;
    font-size: 0.88rem;
}

#postcode:focus {
    outline: none;
    border-color: #e94560;
}

#search-btn {
    padding: 7px 14px;
    background: #e94560;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    transition: background 0.15s;
}

#search-btn:hover  { background: #c73652; }
#search-btn:disabled { background: #555; cursor: not-allowed; }

#controls {
    margin-top: 10px;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.82rem;
    color: #bbb;
    cursor: pointer;
    user-select: none;
}

.toggle-label input { cursor: pointer; accent-color: #e94560; }

#coords-wrap {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

#coords-wrap.hidden { display: none; }

#coords {
    font-size: 0.72rem;
    color: #888;
    font-family: monospace;
}

#reload-btn {
    padding: 3px 10px;
    background: #e94560;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
}

#reload-btn:hover { background: #c73652; }

#progress-wrap {
    margin-top: 10px;
}

#progress-wrap.hidden { display: none; }

#progress-bar {
    height: 3px;
    background: #1a1a2e;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 5px;
}

#progress-fill {
    height: 100%;
    background: #e94560;
    width: 0%;
    transition: width 0.25s ease;
}

#status-text {
    font-size: 0.72rem;
    color: #aaa;
}

#route-count {
    padding: 6px 14px;
    font-size: 0.72rem;
    color: #666;
    border-bottom: 1px solid #0f3460;
    flex-shrink: 0;
    min-height: 26px;
}

/* ── Route list ──────────────────────────────────────────────────────────── */

#route-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

#route-list::-webkit-scrollbar       { width: 4px; }
#route-list::-webkit-scrollbar-track { background: #16213e; }
#route-list::-webkit-scrollbar-thumb { background: #0f3460; border-radius: 2px; }

.route-item {
    display: flex;
    align-items: center;
    padding: 7px 14px;
    cursor: pointer;
    gap: 10px;
    transition: background 0.12s;
    border-left: 3px solid transparent;
}

.route-item:hover  { background: #0f3460; }

.route-item.active {
    background: #1a2a50;
    border-left-color: #e94560;
}

.route-swatch {
    width: 22px;
    height: 4px;
    border-radius: 2px;
    flex-shrink: 0;
}

.route-distance {
    font-size: 0.88rem;
    font-weight: 500;
}

/* ── Map ─────────────────────────────────────────────────────────────────── */

#map {
    flex: 1;
    min-width: 0;
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
    #app        { flex-direction: column; }
    #sidebar    { width: 100%; min-width: unset; max-height: 45vh; }
}
