:root {
    --bg: #f3f5f7;
    --panel: #ffffff;
    --text: #1f2937;
    --muted: #667085;
    --line: #d9e2ec;
    --brand: #b42318;
    --brand-dark: #7f1d1d;
    --shadow: 0 18px 42px rgba(15, 23, 42, .12);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    color: inherit;
}

.app-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 390px minmax(0, 1fr);
}

.sidebar {
    position: relative;
    z-index: 3;
    height: 100vh;
    overflow: auto;
    padding: 18px;
    background: #f8fafc;
    border-right: 1px solid var(--line);
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 10px 24px rgba(15, 23, 42, .06);
}

.brand-mark {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--brand);
    color: #fff;
    font-weight: 800;
    letter-spacing: .04em;
}

.brand-block h1 {
    margin: 0;
    font-size: 23px;
    line-height: 1;
}

.brand-block p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.sidebar-section {
    margin-top: 16px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.form-label,
.section-title {
    color: #334155;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.section-title button {
    border: 0;
    background: transparent;
    color: var(--brand);
    font-size: 12px;
    font-weight: 800;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.search-box input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
}

.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.filter-chip input {
    accent-color: var(--chip-color, var(--brand));
}

.route-list,
.point-list {
    display: grid;
    gap: 9px;
}

.route-card,
.point-card {
    width: 100%;
    display: grid;
    gap: 3px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.route-card {
    grid-template-columns: 8px minmax(0, 1fr);
    align-items: start;
}

.route-card strong,
.route-card small {
    grid-column: 2;
}

.route-card small,
.point-card small {
    color: var(--muted);
}

.route-card.is-active {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(180, 35, 24, .1);
}

.route-color {
    grid-row: 1 / span 2;
    width: 8px;
    height: 100%;
    min-height: 42px;
    border-radius: 999px;
}

.point-card {
    grid-template-columns: 11px minmax(0, 1fr);
}

.point-dot {
    width: 11px;
    height: 11px;
    margin-top: 4px;
    border-radius: 999px;
    background: var(--point-color, var(--brand));
}

.point-card strong,
.point-card span,
.point-card small {
    grid-column: 2;
}

.counter {
    display: inline-flex;
    min-width: 28px;
    height: 24px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #eef2f7;
    color: #334155;
}

.map-shell {
    position: relative;
    min-width: 0;
    height: 100vh;
    background: #dbe4ee;
}

.map-canvas {
    width: 100%;
    height: 100%;
}

.topbar {
    position: absolute;
    z-index: 2;
    top: 18px;
    left: 18px;
    right: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid rgba(217, 226, 236, .85);
    border-radius: 8px;
    background: rgba(255, 255, 255, .94);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.topbar strong {
    display: block;
}

.topbar span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.admin-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    text-decoration: none;
    font-weight: 800;
    white-space: nowrap;
}

.map-warning {
    position: absolute;
    inset: auto 18px 18px 18px;
    z-index: 4;
    max-width: 560px;
    padding: 18px;
    border: 1px solid #fecaca;
    border-radius: 8px;
    background: #fff7ed;
    box-shadow: var(--shadow);
}

.map-warning.db-warning {
    bottom: 178px;
}

.map-warning h2 {
    margin: 0 0 8px;
    font-size: 21px;
}

.map-warning p {
    margin: 0 0 8px;
    color: #7c2d12;
}

.info-card {
    width: 260px;
}

.info-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 8px;
}

.info-card h3 {
    margin: 0 0 5px;
    font-size: 18px;
}

.info-card p {
    margin: 0 0 8px;
    color: #475569;
    font-size: 13px;
}

.info-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.info-actions a {
    padding: 6px 8px;
    border-radius: 6px;
    background: #f1f5f9;
    color: #1f2937;
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
}

.detail-page {
    background: #f8fafc;
}

.detail-hero {
    padding: 28px 0;
    border-bottom: 1px solid var(--line);
    background: #fff;
}

.detail-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 26px rgba(15, 23, 42, .06);
}

.detail-map {
    height: 420px;
    border-radius: 8px;
    background: #dbe4ee;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.meta-item {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.meta-item span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.meta-item strong {
    display: block;
    margin-top: 4px;
}

@media (max-width: 980px) {
    .app-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        height: auto;
        max-height: none;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .map-shell {
        height: 70vh;
    }

    .topbar {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        margin: 12px;
    }

    .map-canvas {
        height: calc(70vh - 92px);
    }

    .meta-grid {
        grid-template-columns: 1fr;
    }
}
