:root {
    --ip-ink: #173423;
    --ip-green: #006b3f;
    --ip-leaf: #57823f;
    --ip-gold: #d5b05a;
    --ip-clay: #b66a1f;
    --ip-sky: #365a7d;
    --ip-mist: #eef2eb;
    --ip-paper: #fffdf7;
    --ip-line: #d7decf;
    --ip-muted: #627162;
    --shadow: 0 18px 45px rgba(23, 52, 35, 0.14);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ip-ink);
    background: var(--ip-paper);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.is-hidden {
    display: none !important;
}

a {
    color: inherit;
}

code {
    border-radius: 4px;
    background: rgba(23, 52, 35, 0.08);
    padding: 0.1rem 0.25rem;
}

.map-shell,
.admin-shell {
    min-height: 100vh;
    background:
        linear-gradient(180deg, rgba(238, 242, 235, 0.84), rgba(255, 253, 247, 0.9)),
        var(--ip-paper);
}

.map-header,
.admin-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1rem;
    align-items: center;
    padding: 1.1rem clamp(1rem, 4vw, 2rem);
    border-bottom: 1px solid var(--ip-line);
    background: rgba(255, 253, 247, 0.92);
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border-radius: 6px;
    color: var(--ip-paper);
    background: var(--ip-green);
    text-decoration: none;
    font-weight: 800;
}

.eyebrow {
    margin: 0 0 0.2rem;
    color: var(--ip-muted);
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
}

h1,
h2 {
    margin: 0;
    line-height: 1.12;
    letter-spacing: 0;
}

h1 {
    font-size: clamp(1.35rem, 3vw, 2rem);
}

h2 {
    font-size: 1.2rem;
}

.admin-link,
.pure-button-primary {
    border-radius: 5px;
    background: var(--ip-green);
    color: var(--ip-paper);
}

.map-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    padding: 1rem clamp(1rem, 4vw, 2rem);
}

.segmented-control {
    display: inline-grid;
    grid-template-columns: repeat(2, minmax(8.5rem, 1fr));
    border: 1px solid var(--ip-line);
    border-radius: 6px;
    overflow: hidden;
    background: #ffffff;
}

.segmented-control button {
    min-height: 2.55rem;
    border: 0;
    border-right: 1px solid var(--ip-line);
    background: transparent;
    color: var(--ip-ink);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.segmented-control button:last-child {
    border-right: 0;
}

.segmented-control button.active {
    background: var(--ip-ink);
    color: var(--ip-paper);
}

.filter-select {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    color: var(--ip-muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.filter-select select {
    min-width: 11rem;
    border: 1px solid var(--ip-line);
    border-radius: 5px;
    padding: 0.55rem 0.7rem;
    background: #ffffff;
    color: var(--ip-ink);
}

.map-stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(18rem, 24rem);
    gap: 1rem;
    padding: 0 clamp(1rem, 4vw, 2rem) 2rem;
}

.map-canvas-wrap {
    position: relative;
    min-height: 67vh;
    overflow: hidden;
    border: 1px solid var(--ip-line);
    border-radius: 8px;
    background: var(--ip-mist);
    box-shadow: var(--shadow);
}

.map-canvas {
    position: absolute;
    inset: 0;
}

.token-notice {
    position: absolute;
    inset: auto 1rem 1rem 1rem;
    max-width: 34rem;
    border: 1px solid var(--ip-line);
    border-radius: 8px;
    background: rgba(255, 253, 247, 0.94);
    padding: 1rem;
    box-shadow: var(--shadow);
}

.token-notice h2 {
    margin-bottom: 0.45rem;
}

.token-notice p:last-child {
    margin-bottom: 0;
}

.facility-panel,
.admin-panel {
    border: 1px solid var(--ip-line);
    border-radius: 8px;
    background: rgba(255, 253, 247, 0.96);
    box-shadow: var(--shadow);
}

.facility-panel {
    display: flex;
    min-height: 20rem;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.1rem;
}

.facility-panel p {
    color: var(--ip-muted);
    line-height: 1.55;
}

.facility-meta {
    margin: 0.5rem 0 0.75rem;
    font-weight: 700;
}

.facility-count {
    display: flex;
    gap: 0.35rem;
    align-items: baseline;
    border-top: 1px solid var(--ip-line);
    padding-top: 1rem;
    color: var(--ip-muted);
}

.facility-count strong {
    color: var(--ip-green);
    font-size: 1.7rem;
}

.admin-main {
    display: grid;
    gap: 1rem;
    padding: 1rem clamp(1rem, 4vw, 2rem) 2rem;
}

.admin-panel {
    padding: 1rem;
}

.section-heading {
    margin-bottom: 1rem;
}

.facility-form input,
.facility-form select,
.facility-form textarea {
    border: 1px solid var(--ip-line);
    border-radius: 5px;
    box-shadow: none;
}

.form-grid {
    margin: -0.45rem;
}

.form-grid > label {
    padding: 0.45rem;
    color: var(--ip-ink);
    font-weight: 700;
}

.field-error {
    display: block;
    margin-top: 0.25rem;
    color: #9b2f24;
    font-size: 0.85rem;
}

.checkbox-row,
.button-row {
    display: flex;
    gap: 0.7rem;
    align-items: center;
    margin-top: 1rem;
}

.button-row {
    flex-wrap: wrap;
}

.table-scroll {
    overflow-x: auto;
}

.location-table {
    width: 100%;
    min-width: 52rem;
}

.location-table th {
    color: var(--ip-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0;
}

.status-pill {
    display: inline-block;
    border-radius: 999px;
    background: var(--ip-mist);
    padding: 0.2rem 0.55rem;
    color: var(--ip-green);
    font-size: 0.78rem;
    font-weight: 800;
}

.actions-cell {
    white-space: nowrap;
}

.button-small {
    padding: 0.35rem 0.55rem;
    border-radius: 5px;
    font-size: 0.82rem;
}

.button-danger {
    background: #f6e8e3;
    color: #8b2c1f;
}

@media (max-width: 840px) {
    .map-stage {
        grid-template-columns: 1fr;
    }

    .map-canvas-wrap {
        min-height: 58vh;
    }
}

@media (max-width: 560px) {
    .map-header,
    .admin-header {
        grid-template-columns: auto 1fr;
    }

    .admin-link {
        grid-column: 1 / -1;
    }

    .segmented-control {
        width: 100%;
        grid-template-columns: 1fr;
    }

    .segmented-control button {
        border-right: 0;
        border-bottom: 1px solid var(--ip-line);
    }

    .segmented-control button:last-child {
        border-bottom: 0;
    }

    .filter-select {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
    }
}
