: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-home-link {
    color: inherit;
    text-decoration: none;
}

.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-actions {
    display: flex;
    align-items: center;
    gap: 24px;
}

.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;
}

.account-link {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    color: #fff;
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 700;
}

.account-link:hover,
.account-link:focus {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.account-icon {
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-radius: 50%;
    position: relative;
}

.account-icon::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -9px;
    width: 20px;
    height: 11px;
    border: 2px solid currentColor;
    border-bottom: 0;
    border-radius: 12px 12px 0 0;
    transform: translateX(-50%);
}

.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: 18px;
    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: 230px;
    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 {
    position: relative;
    display: grid;
    gap: 6px;
}

.legend-categories {
    display: grid;
    gap: 7px;
}

.legend-category-button {
    width: 100%;
    min-height: 32px;
    display: grid;
    grid-template-columns: 35px minmax(0, 1fr) 14px;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #475467;
    font-size: 0.78rem;
    font-weight: 650;
    line-height: 1.25;
    text-align: left;
    cursor: pointer;
}

.legend-category-button:hover,
.legend-category-button:focus {
    border-color: #cbd5e1;
    background: rgba(52, 64, 84, 0.08);
    color: #17202a;
    box-shadow: 0 6px 16px rgba(17, 24, 39, 0.12);
    outline: 0;
    transform: translateX(2px);
}

.legend-category-button:hover .legend-chevron,
.legend-category-button:focus .legend-chevron {
    color: #17202a;
    transform: translateX(2px);
}

.legend-chevron {
    justify-self: end;
    color: #98a2b3;
    font-size: 0.86rem;
    font-weight: 800;
}

.legend-detail-panel {
    position: absolute;
    left: calc(100% + 12px);
    bottom: 0;
    width: 245px;
    padding: 13px 15px;
    border: 1px solid rgba(217, 222, 231, 0.9);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 8px 24px rgba(17, 24, 39, 0.12);
}

.legend-detail-title {
    margin-bottom: 8px;
    color: #17202a;
    font-size: 0.75rem;
    font-weight: 750;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.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-network-icon {
    display: inline-block;
    width: 27px;
    height: 4px;
    justify-self: center;
    border-radius: 99px;
    background: #d14c8b;
}

.legend-substation-square {
    display: inline-block;
    width: 13px;
    height: 13px !important;
    justify-self: center;
    border: 1.5px solid #ffffff;
    border-radius: 4px;
    box-shadow: 0 0 0 1px rgba(17, 24, 39, 0.18);
}

.legend-status-dot {
    width: 11px;
    height: 11px;
    justify-self: center;
    border-radius: 50%;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 3px rgba(17, 24, 39, 0.08);
}

.legend-substation-item,
.legend-datacenter-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%
    );
}

.legend-datacenter {
    position: relative;
    width: 24px;
    height: 16px;
    justify-self: center;
}

.legend-datacenter::before {
    content: "";
    position: absolute;
    inset: 3px 2px 2px;
    border: 1.5px solid #0f766e;
    border-radius: 4px;
    background: rgba(20, 184, 166, 0.22);
}

.legend-datacenter::after {
    content: "";
    position: absolute;
    right: 1px;
    top: 0;
    width: 9px;
    height: 9px;
    border: 1.5px solid #fff;
    border-radius: 50%;
    background: #0f766e;
    box-shadow: 0 0 0 1px #0f766e;
}

.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);
}

.maplibregl-popup-content {
    padding: 8px 10px;
    border-radius: 6px;
    box-shadow: 0 8px 20px rgba(17, 24, 39, 0.18);
}

.feature-popup {
    display: grid;
    gap: 2px;
    max-width: 260px;
}

.feature-popup strong {
    color: #17202a;
    font-size: 0.78rem;
    line-height: 1.2;
}

.feature-popup span {
    color: #667085;
    font-size: 0.68rem;
    line-height: 1.25;
}

.coordinate-copy-popup,
.measurement-popup-content {
    display: grid;
    gap: 2px;
}

.coordinate-copy-popup strong,
.measurement-popup-content strong {
    color: #17202a;
    font-size: 0.78rem;
    line-height: 1.2;
}

.coordinate-copy-popup span {
    color: #667085;
    font-size: 0.68rem;
    line-height: 1.25;
}

.maplibregl-ctrl-top-right {
    display: grid;
    justify-items: end;
    gap: 8px;
}

.maplibregl-ctrl-measure button {
    color: #17202a;
    display: grid;
    place-items: center;
}

.maplibregl-ctrl-measure .measure-icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.3;
}

.maplibregl-ctrl-measure .measure-toggle.is-active {
    background: #17202a;
    color: #ffffff;
}

.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-title-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.parcel-zone-badge {
    background: #e8f1ff;
    color: #174ea6;
}

.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-details-button {
    width: 100%;
    margin-bottom: 18px;
    font-size: 0.82rem;
    font-weight: 700;
}

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

.parcel-modal-content {
    display: grid;
    gap: 18px;
}

.modal-dialog.parcel-details-modal-dialog {
    max-width: 800px;
}

.parcel-modal-title h3 {
    margin-bottom: 0;
}

.parcel-modal-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.parcel-modal-section h4 {
    margin: 0 0 10px;
    color: var(--ink);
    font-size: 0.95rem;
    font-weight: 800;
}

.parcel-modal-card {
    margin-bottom: 10px;
    padding: 0 12px;
    border: 1px solid #edf0f3;
    border-radius: 8px;
    background: #fbfcfd;
}

.parcel-modal-empty {
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.parcel-modal-disclaimer {
    margin: 0;
    font-size: 0.78rem;
}

.details-list {
    margin: 0;
}

.locked-details {
    position: relative;
    min-height: 190px;
    /* overflow: hidden; */
}

.details-list-locked {
    filter: blur(4px);
    opacity: 0.62;
    pointer-events: none;
    user-select: none;
}

.details-list-locked .detail-row dd {
    color: transparent;
    text-shadow: 0 0 10px rgba(52, 64, 84, 0.72);
}

.locked-details::after {
    position: absolute;
    inset: 0;
    content: "";
    background: rgba(255, 255, 255, 0.58);
}

.locked-details-message {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 1;
    width: min(92%, 320px);
    padding: 18px 20px;
    border: 1px solid #dbe2ea;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 12px 30px rgba(17, 24, 39, 0.16);
    text-align: center;
    transform: translate(-50%, -50%);
}

.locked-details-message-plain {
    position: static;
    width: 100%;
    max-width: 340px;
    margin: 0 auto;
    transform: none;
}

.locked-details-icon {
    position: relative;
    display: inline-block;
    width: 22px;
    height: 18px;
    margin-bottom: 10px;
    border: 2px solid #475467;
    border-radius: 4px;
}

.locked-details-icon::before {
    position: absolute;
    left: 50%;
    bottom: 12px;
    width: 12px;
    height: 10px;
    border: 2px solid #475467;
    border-bottom: 0;
    border-radius: 9px 9px 0 0;
    content: "";
    transform: translateX(-50%);
}

.locked-details-message p {
    margin: 0 0 10px;
    color: #1f2937;
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.35;
}

.locked-details-link {
    color: #0d6efd;
    font-size: 0.84rem;
    font-weight: 800;
    text-decoration: none;
}

.locked-details-link:hover {
    text-decoration: underline;
}

.locked-parcel-details {
    padding-top: 42px;
    padding-bottom: 42px;
}

.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;
}

.account-page {
    max-width: 600px;
    min-height: calc(100vh - 86px);
    margin: auto;
    padding: 34px 28px;
    background: #f3f5f7;
}

.account-intro {
    text-align: center;
    max-width: 980px;
    margin: 0 auto 24px;
}

.account-intro h1 {
    margin: 0 0 8px;
    font-size: 1.7rem;
}

.account-intro p {
    max-width: 680px;
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.account-grid {
    max-width: 760px;
    margin: 0 auto;
    display: grid;
    gap: 18px;
}

.account-panel {
    min-height: 100%;
    padding: 22px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(17, 24, 39, 0.08);
}

.account-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 28px;
}

.account-toggle-button {
    min-width: 110px;
    min-height: 54px;
    border: 1px solid #cfd4dc;
    border-radius: 7px;
    color: #5f6875;
    background: #fff;
    font-size: 1rem;
    font-weight: 700;
}

.account-toggle-button.active,
.account-toggle-button:active {
    border-color: #c8cbd1;
    background: #e5e5e5;
    color: #2d333b;
    box-shadow: inset 0 0 0 4px rgba(0, 0, 0, 0.04);
}

.account-panel-title {
    margin: 0 0 14px;
    font-size: 1.1rem;
}

.account-panel-copy {
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 0.87rem;
    line-height: 1.45;
}

.account-feedback {
    min-height: 22px;
    color: #b42318;
    font-size: 0.82rem;
}

.account-summary-grid,
.account-profile-complete {
    display: grid;
    gap: 8px;
    margin-bottom: 18px;
}

.account-summary-grid span,
.account-profile-complete span {
    color: var(--muted);
}

.account-profile-warning {
    margin-bottom: 18px;
    padding: 10px 12px;
    border: 1px solid #fedf89;
    border-radius: 7px;
    background: #fffbeb;
    color: #92400e;
    font-size: 0.86rem;
}

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

    .header-stats,
    .header-stat {
        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: 760px) {
    .parcel-modal-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 980px) {
    .header-actions {
        gap: 12px;
    }
}

@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;
    }
}
