:root {
    --brand: #2f4f3a;
    --brand-dark: #22392a;
    --st-available: #2e9e4f;
    --st-partial: #e0a800;
    --st-purchased: #1f6fd1;
    --st-occupied: #6c757d;
}

body { background: #f5f6f4; }
/* ~25% taller than Bootstrap's default 56px bar */
.app-navbar { background: var(--brand); position: relative; padding-top: calc(.5rem + 7px); padding-bottom: calc(.5rem + 7px); }
.app-navbar .nav-link { color: #fff; font-weight: 600; }
.app-navbar .nav-link:hover, .app-navbar .nav-link:focus { color: #ffe9a8; }
.app-navbar .nav-link.active { color: #ffe9a8; }
.app-navbar .nav-link { text-shadow: 0 0 4px rgba(0, 0, 0, .9), 0 1px 2px rgba(0, 0, 0, .9) !important; }
.app-navbar > .container-fluid { position: relative; z-index: 1; }
/* Mountain scene laid over the green at ~50% */
.app-navbar::before {
    content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
    background: url("../img/mountains.jpg") center 55% / cover no-repeat; opacity: .5;
}
.app-navbar .navbar-brand, .app-navbar .nav-link { text-shadow: 0 1px 3px rgba(0, 0, 0, .55); }
.app-navbar .navbar-brand { font-weight: 600; display: inline-flex; align-items: center; gap: .4rem; }
.app-navbar .brand-sheep { height: 2.2em; width: auto; margin: -.4em 0; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .5)); }

/* ---------- Public map page ---------- */
body.map-page { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.map-shell { flex: 1; display: flex; min-height: 0; position: relative; }
.map-side {
    width: 330px; flex: 0 0 330px; background: #fff; border-right: 1px solid #dde1dc;
    display: flex; flex-direction: column; min-height: 0; z-index: 2;
}
.map-side .side-head { padding: .75rem; border-bottom: 1px solid #eceeea; }
.map-side .side-list { overflow-y: auto; flex: 1; }
.map-side .side-list .list-group-item { cursor: pointer; border-left: 0; border-right: 0; }
.map-side .side-list .list-group-item:hover { background: #f1f5f0; }
#map { flex: 1; min-height: 0; background: #dfe5dc; isolation: isolate; }
.admin-map { isolation: isolate; }
.map-missing { display: flex; align-items: center; justify-content: center; text-align: center; padding: 2rem; color: #555; }

.crumbs { font-size: .9rem; }
.crumbs a { text-decoration: none; }
.crumbs .sep { color: #999; margin: 0 .25rem; }

.search-wrap { position: relative; }
.search-results {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 1000; background: #fff;
    border: 1px solid #ccd3cb; border-top: 0; border-radius: 0 0 .5rem .5rem;
    box-shadow: 0 8px 18px rgba(0,0,0,.12); max-height: 360px; overflow-y: auto; display: none;
    list-style: none; margin: 0; padding: 0;
}
.search-results li { padding: .5rem .75rem; cursor: pointer; border-bottom: 1px solid #f0f0f0; }
.search-results li .loc { font-size: .78rem; color: #6c757d; }
.search-results li.active, .search-results li:hover { background: #e8f1ea; }
.search-results li.empty { cursor: default; color: #6c757d; }
.search-results mark { padding: 0; background: #fff1a8; }

.legend { display: flex; flex-wrap: wrap; gap: .35rem .9rem; font-size: .8rem; }
.legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.sw.available, .tile.available { background: var(--st-available); }
.sw.partial { background: var(--st-partial); }
.sw.purchased, .tile.purchased { background: var(--st-purchased); }
.sw.occupied, .tile.occupied { background: var(--st-occupied); }

/* Hover bubble that follows the cursor (Leaflet sticky tooltip) */
.leaflet-tooltip.cem-tip {
    border: 0; border-radius: .5rem; padding: .5rem .7rem; box-shadow: 0 4px 14px rgba(0,0,0,.25);
    font-size: .85rem; max-width: 260px; white-space: normal; color: #222;
}
.leaflet-tooltip.cem-tip::before { display: none; }
.cem-tip .tt { font-weight: 600; margin-bottom: 2px; }
.cem-tip .counts span { margin-right: .5rem; white-space: nowrap; }

/* Section / subsection / plat number labels (Leaflet divIcon) */
.plat-label { background: none; border: 0; pointer-events: none; }
.plat-label span {
    position: absolute; transform: translate(-50%, -50%); font: 600 11px/1 system-ui, sans-serif;
    color: #fff; text-shadow: 0 0 3px #000, 0 0 2px #000; white-space: nowrap;
}
.leaflet-container { font: inherit; }
.leaflet-popup-content { margin: .6rem .8rem; }

/* Admin map editor: number labels on the current shape and its neighbours */
.leaflet-tooltip.geo-label {
    background: none; border: 0; box-shadow: none; padding: 0;
    font: 600 12px/1 system-ui, sans-serif; color: #fff; text-shadow: 0 0 3px #000, 0 0 2px #000;
}
.leaflet-tooltip.geo-label::before { display: none; }
.leaflet-tooltip.geo-label-self { color: #ffeb3b; font-size: 14px; }

/* Admin map editor: side lengths in feet */
.dim-label { pointer-events: none; }
.dim-label span {
    position: absolute; transform: translate(-50%, -50%); white-space: nowrap;
    font: 600 10px/1 system-ui, sans-serif; color: #fff; background: rgba(255, 23, 68, .85);
    padding: 2px 4px; border-radius: 3px;
}
.geo-tools .btn.active { color: #fff; background: var(--brand); border-color: var(--brand); }

/* Admin: plot location pin */
.point-pin { background: #ff1744; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 4px rgba(0,0,0,.6); }

/* Plat modal plot grid */
/* Fixed-size tiles that wrap to a new row after 5 (fewer on narrow screens). */
.plot-grid {
    --tile-w: 140px; --tile-gap: .5rem;
    display: flex; flex-wrap: wrap; gap: var(--tile-gap);
    max-width: calc(5 * var(--tile-w) + 4 * var(--tile-gap));
}
.plot-grid .tile {
    flex: 0 0 var(--tile-w); width: var(--tile-w); height: 130px; overflow: hidden;
    border-radius: .5rem; color: #fff; padding: .6rem; cursor: pointer;
    display: flex; flex-direction: column; transition: transform .1s, box-shadow .1s; border: 0; text-align: left;
}
.plot-grid .tile:hover, .plot-grid .tile:focus { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(0,0,0,.25); }
.plot-grid .tile .num { font-weight: 700; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plot-grid .tile .who {
    font-size: .78rem; opacity: .95; line-height: 1.25; margin-top: auto; overflow-wrap: anywhere;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4; overflow: hidden;
}
.plot-grid .tile { position: relative; }
.plot-grid .tile .flat-badge {
    position: absolute; top: .45rem; right: .45rem; cursor: help;
    font: 700 .62rem/1 system-ui, sans-serif; text-transform: uppercase; letter-spacing: .04em;
    color: #222; background: rgba(255, 255, 255, .92); padding: 3px 5px; border-radius: .3rem;
}
.plot-grid .tile:has(.flat-badge) .num { padding-right: 2.4rem; }
.plot-grid .tile .st { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; opacity: .85; }

.contrib-photos img { width: 120px; height: 120px; object-fit: cover; border-radius: .4rem; }
.plot-photo { max-height: 260px; object-fit: cover; border-radius: .5rem; }

@media (max-width: 767.98px) {
    body.map-page { overflow: auto; height: auto; }
    .map-shell { flex-direction: column; }
    .map-side { width: 100%; flex: none; border-right: 0; border-bottom: 1px solid #dde1dc; }
    .map-side .side-list { max-height: 220px; }
    #map { height: 65vh; flex: none; }
}

/* ---------- Admin ---------- */
.admin-sidebar { background: #fff; border-right: 1px solid #e3e6e2; min-height: calc(100vh - 70px); }
.admin-sidebar .nav-link { color: #333; padding: .4rem .7rem; }
.admin-sidebar .nav-link.active { background: var(--brand); color: #fff; }
.admin-sidebar .tools-toggle .when-closed, .admin-sidebar .tools-toggle.collapsed .when-open { display: none; }
.admin-sidebar .tools-toggle.collapsed .when-closed { display: inline-block; }
.admin-sidebar .tools-toggle .bi-chevron-down { transition: transform .2s; transform: rotate(180deg); }
.admin-sidebar .tools-toggle.collapsed .bi-chevron-down { transform: none; }
.admin-map { height: 460px; border-radius: .5rem; border: 1px solid #ccd3cb; }
.table-sm td, .table-sm th { vertical-align: middle; }
.stat-card .display-6 { font-weight: 600; }
.thumb { width: 160px; height: 160px; object-fit: cover; border-radius: .4rem; }
.msg { border-radius: .5rem; padding: .5rem .75rem; margin-bottom: .5rem; }
.msg.staff { background: #e8f1ea; }
.msg.user { background: #eef2f8; }

/* Infant badge on the public grave card (beside the Veteran badge). */
.badge-infant { background: #8e6fb5; color: #fff; }
