:root {
    --navy: #111922;
    --navy-2: #2D4162;
    --cream: #EAE4D8;
    --sand: #C4A882;
    --white: #F9F7F4;
    --paper: #FFFFFF;
    --teal: #1A6E7A;
    --text: #1C2B3A;
    --muted: #6B7A8D;
    --line: #EDE8E0;
    --soft-line: rgba(28, 43, 58, 0.08);
    --shadow: 0 8px 32px rgba(28, 43, 58, 0.08);
    --glass: rgba(255, 255, 255, 0.74);
    --red: #B73A2E;
    --green: #1A6E7A;
    --orange: #B47B26;
}

html {
    scroll-behavior: smooth;
}

body.li-app {
    min-height: 100vh;
    font-family: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        linear-gradient(180deg, #ffffff 0%, var(--white) 48%, #ffffff 100%);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    letter-spacing: 0;
    -webkit-font-smoothing: antialiased;
}

.li-app *,
.li-app *::before,
.li-app *::after {
    letter-spacing: 0;
}

.li-app .hidden {
    display: none !important;
}

/* Header */
.li-app .app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    height: 64px;
    padding: 0 48px;
    background: rgba(255, 255, 255, 0.86);
    color: var(--navy);
    border-bottom: 1px solid rgba(28, 43, 58, 0.08);
    box-shadow: none;
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    font-family: inherit;
}

.li-app .app-header-brand,
.li-app .app-header-title {
    color: var(--navy);
}

.li-app .app-header-brand {
    min-width: 0;
    flex-shrink: 0;
}

.li-app .app-header-logo,
.li-app .logo-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--navy);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.li-app .app-header-logo svg,
.li-app .logo-icon svg {
    width: 15px;
    height: 15px;
}

.li-app .app-header-title {
    font-size: 16px;
    font-weight: 700;
}

.li-app .app-header-sep {
    color: rgba(28, 43, 58, 0.22);
    font-weight: 500;
}

.li-app .app-header-product {
    color: var(--navy-2);
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
}

.li-app .app-header-tools {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 22px;
}

.li-app .app-header-nav {
    gap: 12px;
}

.li-app .app-header-link {
    height: 64px;
    padding: 0 4px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    transition: color 0.15s ease;
}

.li-app .app-header-link:hover {
    color: var(--navy);
}

/* Hero */
.li-app #hero {
    min-height: 100svh;
    padding: 72px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(180deg, #ffffff 0%, rgba(249, 247, 244, 0.92) 62%, #ffffff 100%);
}

.li-app #hero::before {
    display: none;
}

.li-app .hero-box {
    width: min(100%, 820px);
    max-width: none;
    padding: 0;
    background: transparent;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.li-app .hero-brand-lockup {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--navy);
    font-size: 22px;
    font-weight: 700;
}

.li-app .hero-brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 7px;
    background: var(--navy);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.li-app .hero-brand-logo svg {
    width: 17px;
    height: 17px;
}

.li-app .hero-brand-sep {
    color: rgba(28, 43, 58, 0.25);
    font-weight: 500;
}

.li-app #search-form {
    width: min(100%, 820px);
    margin: 0 auto;
}

.li-app .hero-inputs {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.78fr) auto;
    align-items: stretch;
    gap: 12px;
    margin: 0;
    padding: 12px;
    background: var(--glass);
    border: 1px solid rgba(255, 255, 255, 0.95);
    border-radius: 999px;
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(28px) saturate(1.8);
    -webkit-backdrop-filter: blur(28px) saturate(1.8);
}

.li-app .form-field {
    position: relative;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 0 16px;
    text-align: left;
}

.li-app .form-field + .form-field {
    border-left: 1px solid rgba(28, 43, 58, 0.08);
}

.li-app .form-field label {
    color: var(--teal);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.li-app .hero-inputs input,
.li-app #search-form-compact input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--navy);
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
}

.li-app .hero-inputs input::placeholder,
.li-app #search-form-compact input::placeholder {
    color: var(--muted);
}

.li-app .hero-inputs .input-wrap {
    flex: none;
}

.li-app .hero-inputs .input-wrap input {
    border-right: 0;
}

.li-app #search-form button,
.li-app #search-form-compact button,
.li-app #export-pdf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    width: auto;
    border: 1.5px solid var(--navy);
    border-radius: 999px;
    background: transparent;
    color: var(--navy);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.li-app #search-form button {
    min-width: 132px;
    padding: 0 24px;
}

.li-app #search-form button:hover,
.li-app #search-form-compact button:hover,
.li-app #export-pdf-btn:hover {
    background: var(--navy);
    color: var(--white);
    border-color: var(--navy);
}

.li-app #search-form button:disabled,
.li-app #search-form-compact button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.li-app .hero-labels {
    display: none;
}

/* Autocomplete */
.li-app .ko-dropdown {
    top: calc(100% + 18px);
    left: 0;
    right: 0;
    z-index: 200;
    max-height: 240px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 34px rgba(28, 43, 58, 0.12);
}

.li-app .ko-dropdown .ko-item {
    padding: 10px 14px;
    color: var(--navy);
    font-size: 13px;
    gap: 12px;
}

.li-app .ko-dropdown .ko-item:hover,
.li-app .ko-dropdown .ko-item.active {
    background: rgba(26, 110, 122, 0.08);
}

.li-app .ko-dropdown .ko-id {
    color: var(--muted);
}

/* Loading and error */
.li-app #loading {
    background: rgba(249, 247, 244, 0.92);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.li-app .spinner-block,
.li-app .step-spinner-block {
    background: var(--teal);
    border-radius: 2px;
}

.li-app .loading-step {
    color: var(--muted);
    font-size: 13px;
}

.li-app .loading-step.active {
    color: var(--navy);
}

.li-app .loading-step.done {
    color: var(--teal);
}

.li-app #error-msg {
    max-width: 640px;
    margin: 104px auto 0;
    padding: 14px 18px;
    color: var(--red);
    background: #fff;
    border: 1px solid rgba(183, 58, 46, 0.28);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

/* Results shell */
.li-app #results {
    padding-top: 64px;
}

.li-app main {
    max-width: 1180px;
}

.li-app .logo-icon--sm {
    width: 24px;
    height: 24px;
    border-radius: 5px;
}

.li-app #search-form-compact {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
}

.li-app #search-form-compact input {
    width: 150px;
    min-height: 38px;
    padding: 0 14px;
    background: rgba(249, 247, 244, 0.82);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 13px;
}

.li-app #search-form-compact button {
    min-height: 38px;
    padding: 0 18px;
}

.li-app main {
    padding: 24px 32px 64px;
}

.li-app .title-bar {
    margin-bottom: 18px;
    padding: 16px 18px;
    background: var(--navy);
    color: var(--white);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(17, 25, 34, 0.12);
    font-size: 16px;
    font-weight: 700;
}

.li-app .title-bar-left {
    min-width: 0;
    flex-wrap: wrap;
}

.li-app .title-sep {
    color: rgba(249, 247, 244, 0.38);
    opacity: 1;
}

.li-app #export-pdf-btn {
    min-height: 34px;
    padding: 0 16px;
    color: var(--white);
    border-color: rgba(249, 247, 244, 0.45);
}

.li-app #export-pdf-btn:hover {
    background: var(--white);
    color: var(--navy);
    border-color: var(--white);
}

/* Panels */
.li-app .top-row {
    gap: 16px;
    margin-bottom: 16px;
}

.li-app .panel,
.li-app .card,
.li-app .detail-section {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 4px 22px rgba(28, 43, 58, 0.04);
}

.li-app .panel {
    overflow: hidden;
    border-top: 2px solid rgba(26, 110, 122, 0.18);
}

.li-app .panel h2 {
    padding: 13px 16px;
    color: var(--muted);
    background: rgba(249, 247, 244, 0.56);
    border-bottom: 1px solid var(--line);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.li-app #map,
.li-app #envelope-diagram {
    height: 460px;
    background: #fbfaf7;
}

.li-app #envelope-diagram {
    padding: 0;
}

.li-app .envelope-3d-wrap .objekt-preview {
    background:
        linear-gradient(90deg, rgba(28, 43, 58, 0.035) 1px, transparent 1px),
        linear-gradient(rgba(28, 43, 58, 0.035) 1px, transparent 1px),
        #fbfaf7;
    background-size: 28px 28px;
}

.li-app .objekt-dim-label {
    font-family: inherit;
}

.li-app .objekt-dim-bld,
.li-app .odmik-label {
    color: var(--navy);
    border-color: var(--navy);
    border-radius: 999px;
    box-shadow: 0 5px 14px rgba(28, 43, 58, 0.1);
}

.li-app .envelope-gabarit {
    background: var(--navy);
    border-radius: 999px;
    font-family: inherit;
}

.li-app .envelope-meta {
    color: var(--navy);
    border-color: var(--line);
    border-radius: 999px;
    font-family: inherit;
}

.li-app .muted,
.li-app .loading-inline,
.li-app .diagram-loading-step {
    color: var(--muted);
}

/* Leaflet */
.li-app .leaflet-container {
    font-family: inherit;
}

.li-app .leaflet-control-zoom a {
    color: var(--navy);
    border-color: var(--line);
}

.li-app .infra-legend {
    padding: 9px 10px;
    color: var(--navy);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    box-shadow: 0 8px 26px rgba(28, 43, 58, 0.12);
    font-family: inherit;
}

.li-app .infra-legend-row {
    border-radius: 6px;
}

.li-app .infra-legend-row:hover {
    background: rgba(26, 110, 122, 0.08);
}

/* Summary cards */
.li-app .cards-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.li-app .card {
    min-height: 154px;
    padding: 18px;
    gap: 7px;
    border-top: 2px solid rgba(26, 110, 122, 0.16);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.li-app .card:hover {
    border-color: rgba(26, 110, 122, 0.38);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.li-app .card-icon {
    margin-bottom: 6px;
}

.li-app .card-icon svg {
    width: 22px;
    height: 22px;
    stroke: var(--teal);
    stroke-width: 1.7;
}

.li-app .card-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.li-app .card-value {
    color: var(--navy);
    font-size: 24px;
    font-weight: 700;
    line-height: 1.1;
}

.li-app .card-sub {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.li-app .val--red {
    color: var(--red);
}

.li-app .val--green {
    color: var(--teal);
}

.li-app .val--orange {
    color: var(--orange);
}

/* Details */
.li-app .details {
    gap: 10px;
}

.li-app .detail-section {
    overflow: hidden;
}

.li-app .detail-header {
    padding: 16px 18px;
    color: var(--navy);
    font-size: 15px;
    font-weight: 700;
    transition: background 0.15s ease;
}

.li-app .detail-header:hover {
    background: rgba(234, 228, 216, 0.28);
}

.li-app .detail-header .arrow {
    color: var(--teal);
}

.li-app .detail-body {
    padding: 0 18px 18px;
    overflow-x: auto;
}

.li-app table {
    font-size: 14px;
}

.li-app th {
    padding: 10px;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.li-app td {
    padding: 10px;
    color: var(--text);
    border-bottom: 1px solid rgba(28, 43, 58, 0.06);
}

.li-app .rules-group {
    border-bottom: 1px solid var(--line);
}

.li-app .rules-group h4 {
    color: var(--teal);
    border-left: 3px solid var(--teal);
    font-size: 12px;
    font-weight: 700;
}

.li-app .rules-list li {
    color: var(--navy);
    background: rgba(26, 110, 122, 0.06);
    border: 1px solid rgba(26, 110, 122, 0.14);
    border-radius: 999px;
}

.li-app .rules-kv li {
    border-bottom: 1px solid rgba(28, 43, 58, 0.06);
}

.li-app .rules-kv .kv-label {
    color: var(--muted);
}

.li-app .zone-list li {
    border-bottom: 1px solid rgba(28, 43, 58, 0.06);
}

.li-app .zone-dot--orange {
    background: var(--orange);
}

.li-app .zone-dot--red {
    background: var(--red);
}

.li-app .diagram-loading {
    margin: auto;
}

@media (max-width: 1180px) {
    .li-app .app-header--results .app-header-nav {
        display: none;
    }
}

@media (max-width: 980px) {
    .li-app .app-header {
        padding: 0 24px;
    }

    .li-app .hero-inputs {
        grid-template-columns: 1fr;
        border-radius: 24px;
        padding: 12px;
    }

    .li-app .form-field {
        min-height: 58px;
        padding: 0 14px;
        border-left: 0 !important;
        border-bottom: 1px solid rgba(28, 43, 58, 0.08);
    }

    .li-app #search-form button {
        width: 100%;
    }

    .li-app .cards-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 800px) {
    .li-app .top-row {
        grid-template-columns: 1fr;
    }

    .li-app #map,
    .li-app #envelope-diagram {
        height: 380px;
    }
}

@media (max-width: 720px) {
    .li-app .app-header {
        min-height: 58px;
        padding: 10px 18px;
    }

    .li-app .app-header--results {
        height: auto;
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .li-app .app-header-tools {
        width: 100%;
    }

    .li-app #hero {
        min-height: 100svh;
        padding: 72px 18px 48px;
    }

    .li-app .hero-brand-lockup {
        font-size: 19px;
    }

    .li-app #results {
        padding-top: 124px;
    }

    .li-app main {
        padding-left: 18px;
        padding-right: 18px;
    }

    .li-app #search-form-compact {
        width: 100%;
        justify-content: stretch;
    }

    .li-app #search-form-compact input {
        width: 0;
        flex: 1;
    }

    .li-app #search-form-compact button {
        flex: 0 0 auto;
    }

    .li-app .title-bar {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .li-app .cards-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    .li-app .hero-brand-lockup {
        font-size: 17px;
        gap: 8px;
    }

    .li-app .hero-inputs {
        border-radius: 18px;
    }

    .li-app .cards-grid {
        grid-template-columns: 1fr;
    }

    .li-app #map,
    .li-app #envelope-diagram {
        height: 320px;
    }
}
