.ppi {
    --ppi-ink: #102033;
    --ppi-muted: #526173;
    --ppi-line: #d7e0e8;
    --ppi-paper: #f4f7fa;
    --ppi-brand: #0d3b66;
    --ppi-accent: #0f766e;
    max-width: none;
    margin: 0;
    padding: 0 0 28px;
    color: var(--ppi-ink);
    line-height: 1.5;
    background: #e7eef2;
    overflow-x: hidden;
}
.ppi h1, .ppi h2 { line-height: 1.25; margin: 0; }
.ppi h1 { font-size: 1.05rem; }
.ppi h2 { font-size: 0.95rem; margin-bottom: 8px; }
.ppi a { color: var(--ppi-brand); }
.ppi-kicker, .ppi-panel-kicker { color: var(--ppi-accent); font-weight: 700; margin: 0 0 2px; font-size: 0.82rem; }
.ppi-lead, .ppi-note, .ppi-fine, .ppi-status { color: var(--ppi-muted); }
.ppi-lead { margin: 0; }
.ppi-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 14px;
    padding: 6px 12px;
    background: #fff;
    border-bottom: 1px solid var(--ppi-line);
}
.ppi-brandline { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.ppi-lead { font-size: 0.82rem; }
.ppi-back {
    margin-inline-start: auto;
    text-decoration: none;
    font-weight: 700;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
}
.ppi-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}
.ppi-map-wrap { position: relative; background: #d5e0e8; }
.ppi-map { height: calc(100dvh - 48px); min-height: 420px; background: #d5e0e8; }
.ppi-map-caption, .ppi-legend, .ppi-gap {
    position: absolute;
    z-index: 2;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 8px 24px rgba(16, 32, 51, 0.12);
}
.ppi-search {
    position: relative;
    width: min(100%, 420px);
    pointer-events: auto;
}
.ppi-search-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.ppi-search input {
    width: 100%;
    min-height: 44px;
    border: 1px solid #d7e0e8;
    border-radius: 999px;
    padding: 8px 14px;
    font: inherit;
    color: var(--ppi-ink);
    background: #fff;
    box-shadow: 0 8px 18px rgba(16, 32, 51, 0.18);
}
.ppi-search-list {
    position: absolute;
    z-index: 6;
    inset-inline: 0;
    top: calc(100% + 4px);
    max-height: min(46dvh, 320px);
    margin: 0;
    padding: 4px;
    overflow: auto;
    list-style: none;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(16, 32, 51, 0.16);
}
.ppi-search-list button {
    display: grid;
    gap: 2px;
    width: 100%;
    min-height: 44px;
    padding: 8px 10px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: start;
}
.ppi-search-list button.is-active,
.ppi-search-list button:hover { background: #e7eef2; }
.ppi-search-list small,
.ppi-search-list span { color: var(--ppi-muted); font-size: 0.78rem; }
.ppi-search-list[hidden] { display: none; }
.ppi-goals {
    position: absolute;
    z-index: 3;
    top: 10px;
    inset-inline-start: 10px;
    inset-inline-end: 58px;
    display: grid;
    gap: 4px;
    justify-items: start;
    max-width: calc(100% - 68px);
    pointer-events: none;
}
.ppi-goal-row {
    display: flex;
    gap: 6px;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    pointer-events: auto;
}
.ppi-goal-row::-webkit-scrollbar { display: none; }
.ppi-goal, .ppi-goal-skip {
    pointer-events: auto;
    font: inherit;
    cursor: pointer;
}
.ppi-goal {
    flex: 0 0 auto;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    min-height: 44px;
    border: 0;
    border-radius: 14px;
    padding: 6px 12px;
    background: #fff;
    color: var(--ppi-ink);
    border: 1px solid #d7e0e8;
    box-shadow: 0 8px 18px rgba(16, 32, 51, 0.18);
    font-weight: 800;
}
.ppi-goal small { color: var(--ppi-muted); font-weight: 600; font-size: 0.72rem; }
.ppi-goal.is-current { background: var(--ppi-brand); color: #fff; }
.ppi-goal.is-current small { color: #d6e4f0; }
.ppi-goals.is-compact .ppi-goal small,
.ppi-goals.is-compact .ppi-hint { display: none; }
.ppi-goals.is-compact .ppi-goal { min-height: 40px; border-radius: 999px; }
.ppi-goal-skip {
    border: 0;
    background: rgba(255, 255, 255, 0.92);
    color: var(--ppi-brand);
    border-radius: 999px;
    min-height: 32px;
    padding: 4px 10px;
    font-weight: 700;
    text-decoration: underline;
}
.ppi-hint { margin: 0; color: var(--ppi-ink); font-weight: 700; font-size: 0.82rem; background: rgba(255,255,255,.92); border-radius: 999px; padding: 4px 10px; }
.ppi-default-context {
    margin: 0;
    max-width: min(100%, 28rem);
    padding: 6px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--ppi-ink);
    font-weight: 700;
    font-size: 0.82rem;
    line-height: 1.35;
    box-shadow: 0 8px 24px rgba(16, 32, 51, 0.12);
}
.ppi-dock .ppi-default-context { box-shadow: none; background: #f0fdfa; border: 1px solid #99f6e4; }
.ppi-goal-context { margin: 0; padding: 8px 10px; border-radius: 12px; background: #f0fdfa; border: 1px solid #99f6e4; font-weight: 700; }
.ppi-goals .ppi-map-caption {
    position: static;
    margin: 0;
    padding: 0 2px;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    max-width: none;
    font-size: 0.82rem;
}
.ppi-map-caption {
    top: 12px;
    inset-inline-start: 12px;
    margin: 0;
    border-radius: 999px;
    padding: 8px 12px;
    font-weight: 700;
    max-width: min(100% - 24px, 420px);
}
.ppi-legend {
    top: auto;
    bottom: 14px;
    inset-inline-start: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    align-items: center;
    max-width: min(100% - 24px, 460px);
    border-radius: 14px;
    padding: 8px 10px;
    font-size: 0.82rem;
}
.ppi-legend-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.ppi-gap {
    left: 12px;
    right: 12px;
    bottom: 16px;
    margin-inline: auto;
    max-width: 560px;
    border-radius: 16px;
    padding: 12px 14px;
}
.ppi-gap strong { display: block; margin-bottom: 4px; }
.ppi-gap p { margin: 0 0 6px; }
.ppi-gap p:last-child { margin-bottom: 0; }
.ppi-map-fallback {
    position: relative;
    z-index: 2;
    margin: 0;
    padding: 12px 16px;
    background: #fff;
}
.ppi-legend-scale { display: inline-flex; align-items: center; gap: 6px; }
.ppi-scale {
    width: 132px;
    height: 12px;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: linear-gradient(to left, #2563eb, #16a34a, #eab308, #f97316, #dc2626);
}
[dir="ltr"] .ppi-scale { background: linear-gradient(to right, #2563eb, #16a34a, #eab308, #f97316, #dc2626); }
.ppi-attribution { flex-basis: 100%; color: #526173; font-size: 0.75rem; }
.ppi-swatch { width: 16px; height: 16px; border-radius: 4px; border: 1px solid #cbd5e1; display: inline-block; }
.ppi-swatch--low { background: #2563eb; }
.ppi-swatch--mid { background: #16a34a; }
.ppi-swatch--high { background: #dc2626; }
.ppi-swatch--insufficient { background: #d6d3d1; }
.ppi-swatch--none { background: #d6d3d1; }
.ppi-status--alert { color: #9a3412; background: #fff7ed; border: 1px solid #fdba74; border-radius: 8px; padding: 8px 10px; font-weight: 700; }
.ppi-dock {
    background: #fff;
    padding: 16px;
    display: grid;
    gap: 14px;
    align-content: start;
    border-top: 1px solid var(--ppi-line);
}
.ppi-filter { display: grid; gap: 8px; }
.ppi-chips, .ppi-links { display: flex; gap: 8px; }
.ppi-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
.ppi-chip, .ppi-area, .ppi-explore, .ppi-share, .ppi-optional button {
    border: 1px solid var(--ppi-line);
    background: var(--ppi-paper);
    color: var(--ppi-ink);
    border-radius: 999px;
    padding: 8px 12px;
    text-decoration: none;
    font: inherit;
    cursor: pointer;
}
.ppi-chip { display: inline-flex; flex-direction: column; align-items: flex-start; border-radius: 14px; min-height: 44px; flex: 0 0 auto; }
.ppi-chip small, .ppi-area small { color: var(--ppi-muted); }
.ppi-chip.is-current, .ppi-area.is-current { background: var(--ppi-brand); color: #fff; border-color: var(--ppi-brand); }
.ppi-chip.is-current small { color: #d6e4f0; }
.ppi-area-scroll { display: grid; gap: 8px; max-height: 240px; overflow: auto; }
.ppi-area { display: grid; gap: 2px; border-radius: 14px; text-align: start; }
.ppi-median { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; margin: 0; }
.ppi-median span { font-size: 1rem; font-weight: 600; }
.ppi-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.ppi-stats div { background: var(--ppi-paper); border-radius: 12px; padding: 8px; }
.ppi-stats dt { color: var(--ppi-muted); font-size: 0.82rem; }
.ppi-stats dd { margin: 0; font-weight: 700; }
.ppi-explore, .ppi-share, .ppi-optional button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    background: var(--ppi-accent);
    color: #fff;
    border: 0;
    border-radius: 12px;
}
.ppi-banner { border-radius: 12px; padding: 8px 12px; margin: 0; }
.ppi-banner--current { background: #f0fdfa; border: 1px solid #99f6e4; }
.ppi-banner--historical { background: #fff7ed; border: 1px solid #fed7aa; }
.ppi-support, .ppi-method {
    margin: 12px 16px 0;
    background: #fff;
    border: 1px solid var(--ppi-line);
    border-radius: 16px;
    padding: 12px 14px;
}
.ppi-support summary, .ppi-method summary {
    cursor: pointer;
    font-weight: 700;
    min-height: 44px;
    display: flex;
    align-items: center;
}
.ppi-optional { margin-top: 16px; }
.ppi-optional form { display: grid; gap: 10px; }
.ppi-optional label { display: grid; gap: 4px; font-weight: 600; }
.ppi-optional input { min-height: 44px; border: 1px solid var(--ppi-line); border-radius: 10px; padding: 8px 10px; font: inherit; }
.ppi-table-wrap { overflow-x: auto; border: 1px solid var(--ppi-line); border-radius: 14px; margin-top: 8px; }
.ppi-table { width: 100%; border-collapse: collapse; }
.ppi-table th, .ppi-table td { text-align: start; padding: 10px 12px; border-bottom: 1px solid var(--ppi-line); white-space: nowrap; }
.ppi-table th { background: var(--ppi-paper); }
.ppi-links { list-style: none; padding: 0; flex-wrap: wrap; }
.ppi-error { color: #9f1239; }
.ppi-popup { display: grid; gap: 4px; min-width: 200px; color: #102033; }
.ppi-popup strong { font-size: 1rem; }
.ppi-popup p { margin: 0; }
.ppi-popup a { font-weight: 700; }
.maplibregl-popup-content { border-radius: 12px; }
.ppi-filters, .ppi-compare, .ppi-advanced, .ppi-other-types { border-top: 1px solid var(--ppi-line); padding-top: 8px; }
.ppi-filters summary, .ppi-compare summary, .ppi-advanced summary, .ppi-other-types summary {
    cursor: pointer;
    font-weight: 800;
    min-height: 44px;
    display: flex;
    align-items: center;
}
@media (min-width: 980px) {
    .ppi-workspace { grid-template-columns: minmax(0, 1fr) 340px; min-height: calc(100dvh - 48px); }
    .ppi-map { height: calc(100dvh - 48px); min-height: 640px; }
    .ppi-dock { border-top: 0; border-inline-start: 1px solid var(--ppi-line); max-height: calc(100dvh - 48px); overflow: auto; }
    .ppi-optional form { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; }
}
.ppi-loader, .ppi-busy, .ppi-map-error, .ppi-partial {
    position: absolute;
    z-index: 3;
}
.ppi-loader {
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(213, 224, 232, 0.92);
}
.ppi-loader[data-phase="ready"],
.ppi-loader[data-phase="empty"] { display: none; }
.ppi-loader-card, .ppi-map-error, .ppi-partial {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(16, 32, 51, 0.12);
}
.ppi-loader-card { display: grid; justify-items: center; gap: 10px; padding: 18px 22px; }
.ppi-loader-mark {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #d7e0e8;
    border-top-color: #0d3b66;
    animation: ppi-spin 0.8s linear infinite;
}
@keyframes ppi-spin { to { transform: rotate(360deg); } }
.ppi-busy {
    top: 12px;
    inset-inline-end: 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    font-weight: 700;
}
.ppi-busy[hidden], .ppi-map-error[hidden], .ppi-partial[hidden], .ppi-back[hidden] { display: none; }
.ppi-map-error, .ppi-partial {
    left: 12px;
    right: 12px;
    bottom: 16px;
    margin-inline: auto;
    max-width: 420px;
    padding: 12px 14px;
}
.ppi-map-error button, .ppi-legend-toggle, .ppi-sheet-handle {
    min-height: 44px;
    min-width: 44px;
    font: inherit;
}
.ppi-map-error button {
    border: 0;
    border-radius: 12px;
    background: #0d3b66;
    color: #fff;
    padding: 8px 14px;
}
.ppi-legend-toggle { display: none; }
.ppi-swatch--indicative { background: rgba(37, 99, 235, 0.28); }
.ppi-swatch--preliminary { background: rgba(37, 99, 235, 0.4); }
.ppi-swatch--limited { background: rgba(37, 99, 235, 0.66); }
.ppi-sheet-handle { display: none; }
@media (max-width: 979px) {
    .ppi { overflow-x: hidden; }
    .ppi-bar { padding-inline: 12px; padding-top: calc(6px + env(safe-area-inset-top)); }
    .ppi-stats { grid-template-columns: 1fr; }
    .ppi-map { height: calc(100dvh - 46px - env(safe-area-inset-top)); min-height: 320px; }
    .ppi-legend { bottom: calc(88px + env(safe-area-inset-bottom)); max-width: min(100% - 24px, 280px); }
    .ppi-goals { top: 8px; inset-inline: 8px; max-width: none; }
    .ppi-search { width: 100%; }
    .ppi-search-list { max-height: min(38dvh, 240px); }
    .ppi-goal-row { flex-wrap: wrap; overflow-x: visible; }
    .ppi-goal { flex: 1 1 calc(50% - 6px); align-items: center; text-align: center; font-size: 0.84rem; padding: 6px 8px; }
    .ppi-support, .ppi-method { margin-inline: 12px; }
    .ppi-legend-toggle { display: inline-flex; align-items: center; border: 0; background: transparent; color: inherit; font-weight: 700; padding: 0; }
    .ppi-legend.is-collapsed .ppi-legend-item,
    .ppi-legend.is-collapsed .ppi-attribution,
    .ppi-legend.is-collapsed [data-ppi-legend-range],
    .ppi-legend.is-collapsed .ppi-legend-scale { display: none; }
    .ppi-sheet-handle {
        display: grid;
        justify-items: center;
        gap: 4px;
        width: 100%;
        border: 0;
        background: transparent;
        color: inherit;
        padding: 4px 8px 8px;
    }
    .ppi-sheet-grab { width: 42px; height: 4px; border-radius: 999px; background: #cbd5e1; }
    .ppi-sheet-peek { font-weight: 800; }
    .ppi-dock {
        position: fixed;
        inset-inline: 0;
        bottom: 0;
        z-index: 4;
        max-height: 72dvh;
        overflow: auto;
        border-radius: 18px 18px 0 0;
        border-top: 1px solid var(--ppi-line);
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
        transform: translateY(calc(100% - 84px));
        transition: transform 0.24s ease;
    }
    .ppi-dock.is-area { transform: translateY(calc(100% - 188px)); }
    .ppi-dock.is-expanded, .ppi-dock.is-area.is-expanded { transform: none; }
    .maplibregl-ctrl-top-right, .maplibregl-ctrl-top-left { top: 8px; }
}
@media (max-width: 979px) and (orientation: landscape) {
    .ppi-map { height: calc(100dvh - 56px); }
    .ppi-dock { max-height: 58dvh; }
}
