:root {
    --ink: #17202a;
    --muted: #667085;
    --line: #d9dee7;
    --panel: #ffffff;
    --surface: #f3f5f7;
    --accent: #d9363e;
    --shadow: 0 16px 40px rgba(17, 24, 39, 0.12);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--surface);
    color: var(--ink);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
    min-height: 100vh;
    padding: 0;
}

.app-header {
    min-height: 86px;
    padding: 18px 28px;
    background: #15202b;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--accent);
    font-weight: 800;
    letter-spacing: 0.05em;
}

.brand h1 {
    margin: 0 0 3px;
    font-size: 1.3rem;
    font-weight: 700;
}

.brand p {
    margin: 0;
    color: #b7c0cc;
    font-size: 0.88rem;
}

.header-stats {
    display: flex;
    align-items: center;
    gap: 28px;
}

.header-stat {
    display: flex;
    flex-direction: column;
    min-width: 74px;
}

.header-stat strong {
    font-size: 1.05rem;
}

.header-stat span {
    color: #aeb8c4;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.app-main {
    height: calc(100vh - 86px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
}

.map-panel {
    position: relative;
    min-width: 0;
    overflow: hidden;
}

.network-map {
    width: 100%;
    height: 100%;
    background: #dfe6ec;
}

.address-search {
    position: absolute;
    z-index: 1000;
    top: 18px;
    left: 58px;
    width: min(440px, calc(100% - 82px));
}

.address-input-wrap {
    position: relative;
    filter: drop-shadow(0 8px 20px rgba(17, 24, 39, 0.18));
}

.search-icon {
    position: absolute;
    top: 15px;
    left: 16px;
    width: 14px;
    height: 14px;
    border: 2px solid #667085;
    border-radius: 50%;
}

.search-icon::after {
    content: "";
    position: absolute;
    width: 7px;
    height: 2px;
    background: #667085;
    transform: rotate(45deg);
    right: -5px;
    bottom: -3px;
}

.address-input {
    width: 100%;
    min-height: 46px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    padding: 10px 16px 10px 44px;
    outline: 0;
    background: rgba(255, 255, 255, 0.97);
    color: var(--ink);
    font-size: 0.93rem;
}

.address-input:focus {
    border-color: #98a2b3;
    box-shadow: 0 0 0 3px rgba(102, 112, 133, 0.16);
}

.address-suggestions {
    margin-top: 7px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.suggestion-button {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 14px;
    border: 0;
    border-bottom: 1px solid #edf0f3;
    background: rgba(255, 255, 255, 0.98);
    text-align: left;
    cursor: pointer;
}

.suggestion-button:hover,
.suggestion-button:focus {
    background: #f6f8fa;
}

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

.suggestion-label {
    color: var(--ink);
    font-size: 0.88rem;
    font-weight: 600;
}

.suggestion-context {
    color: var(--muted);
    font-size: 0.74rem;
}

.address-status {
    margin-top: 7px;
    display: inline-block;
    padding: 5px 9px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.9);
    color: #475467;
    font-size: 0.75rem;
    box-shadow: 0 4px 12px rgba(17, 24, 39, 0.1);
}

.address-status:empty {
    display: none;
}

.map-legend {
    position: absolute;
    z-index: 900;
    left: 18px;
    bottom: 28px;
    width: 220px;
    padding: 14px 16px;
    border: 1px solid rgba(217, 222, 231, 0.9);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 8px 24px rgba(17, 24, 39, 0.12);
}

.legend-title {
    margin-bottom: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.legend-items {
    display: grid;
    gap: 6px;
}

.legend-checklist {
    display: grid;
    gap: 6px;
}

.legend-checklist-label {
    display: grid !important;
    grid-template-columns: 14px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    margin: 0;
    cursor: pointer;
}

.legend-checkbox {
    width: 13px;
    height: 13px;
    margin: 0;
    accent-color: #344054;
    cursor: pointer;
}

.legend-checklist-label:has(.legend-checkbox:not(:checked)) .legend-item {
    opacity: 0.38;
    text-decoration: line-through;
}

.legend-item {
    display: grid;
    grid-template-columns: 35px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-height: 22px;
    color: #475467;
    font-size: 0.72rem;
    line-height: 1.25;
}

.legend-line {
    display: inline-block;
    width: 27px;
    justify-self: center;
    border-radius: 99px;
}

.legend-substation-item {
    margin-top: 5px;
    padding-top: 7px;
    border-top: 1px solid #e5e7eb;
}

.legend-substation {
    position: relative;
    width: 14px;
    height: 14px;
    justify-self: center;
    border: 1.5px solid #fff;
    border-radius: 4px;
    background: #d14c8b;
    box-shadow: 0 0 0 1px #98a2b3;
}

.legend-substation::before,
.substation-marker-bolt {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 42%;
    height: 58%;
    background: #fff;
    transform: translate(-50%, -50%);
    clip-path: polygon(
        52% 0%,
        12% 52%,
        40% 52%,
        22% 100%,
        86% 36%,
        56% 36%
    );
}

.substation-marker {
    position: relative;
    display: block;
    border-style: solid;
    border-color: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(17, 24, 39, 0.4);
}

.map-note {
    position: absolute;
    z-index: 900;
    right: 12px;
    bottom: 8px;
    color: #475467;
    font-size: 0.67rem;
    text-shadow: 0 1px 2px white;
}

.details-panel {
    min-width: 0;
    padding: 26px 24px;
    overflow-y: auto;
    border-left: 1px solid var(--line);
    background: var(--panel);
}

.details-header {
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.eyebrow {
    margin-bottom: 5px;
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.11em;
}

.details-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.details-empty {
    padding: 52px 8px;
    text-align: center;
}

.details-empty-title {
    margin-bottom: 8px;
    font-weight: 700;
}

.details-empty-copy {
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.5;
}

.feature-title {
    padding: 22px 0 18px;
}

.feature-title h3 {
    margin: 10px 0 0;
    font-size: 1.05rem;
    line-height: 1.38;
}

.network-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 99px;
    background: #f1f3f5;
    color: #475467;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.parcel-badge {
    background: #fff7df;
    color: #9a5b00;
}

.parcel-location {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.8rem;
}

.parcel-metrics {
    display: grid;
    gap: 10px;
    margin-bottom: 20px;
}

.parcel-metric {
    padding: 13px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 9px;
    background: #f8fafc;
}

.parcel-metric-label {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.parcel-metric-value {
    display: block;
    color: var(--ink);
    font-size: 1.25rem;
}

.parcel-metric-extra {
    margin-top: 4px;
    color: #475467;
    font-size: 0.74rem;
    line-height: 1.4;
}

.parcel-details-list {
    margin-bottom: 18px;
}

.parcel-warning {
    margin: 0;
    font-size: 0.76rem;
}

.details-list {
    margin: 0;
}

.detail-row {
    display: grid;
    grid-template-columns: minmax(105px, 0.42fr) minmax(0, 0.58fr);
    gap: 14px;
    padding: 10px 0;
    border-top: 1px solid #edf0f3;
}

.detail-row dt {
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 600;
}

.detail-row dd {
    margin: 0;
    overflow-wrap: anywhere;
    color: #344054;
    font-size: 0.78rem;
    text-align: right;
}

@media (max-width: 900px) {
    .app-header {
        min-height: auto;
        align-items: flex-start;
    }

    .header-stats {
        display: none;
    }

    .app-main {
        height: auto;
        min-height: calc(100vh - 86px);
        grid-template-columns: 1fr;
        grid-template-rows: 68vh auto;
    }

    .details-panel {
        border-top: 1px solid var(--line);
        border-left: 0;
        min-height: 32vh;
    }
}

@media (max-width: 560px) {
    .app-header {
        padding: 14px 16px;
    }

    .brand p {
        display: none;
    }

    .brand h1 {
        font-size: 1.05rem;
    }

    .address-search {
        top: 12px;
        left: 52px;
        width: calc(100% - 64px);
    }

    .map-legend {
        left: 10px;
        bottom: 18px;
        width: 205px;
    }

    .map-note {
        display: none;
    }
}
