:root {
    --bg: #050907;
    --panel: #0C1210;
    --panel2: #111A16;
    --border: #1D2923;
    --green: #50D926;
    --text: #F4F7F5;
    --muted: #A8B0AC;
    --amber: #E9B949;
    --red: #E66A6A;
    --blue: #56A8FF;
}

* {
    box-sizing: border-box;
}

html,
body,
.mch-app {
    width: 100%;
    height: 100%;
    min-height: 100%;
    margin: 0;
}

body {
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
}

[hidden] {
    display: none !important;
}

button,
input,
select {
    font: inherit;
}

.mch-app {
    position: relative;
}


/* Consent */

.mch-consent {
    position: absolute;
    z-index: 5000;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 24px;
    background:
        radial-gradient(circle at 50% 28%, rgba(80,217,38,.08), transparent 35%),
        var(--bg);
}

.mch-consent-card {
    width: min(720px, 100%);
    padding: 38px;
    border: 1px solid rgba(80,217,38,.28);
    border-radius: 16px;
    background: var(--panel);
    box-shadow: 0 20px 60px rgba(0,0,0,.45);
    text-align: center;
}

.mch-consent-logo {
    display: block;
    width: min(230px, 72%);
    height: auto;
    margin: 0 auto 22px;
}

.mch-kicker {
    margin-bottom: 8px;
    color: var(--green);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .07em;
}

.mch-consent h1 {
    margin: 0 0 20px;
    font-size: clamp(32px, 5vw, 48px);
    line-height: 1.08;
}

.mch-consent p {
    margin: 0 auto 14px;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.65;
}

.mch-consent strong {
    color: var(--text);
}

.mch-consent-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 28px;
}

.mch-error {
    margin-top: 18px;
    padding: 12px 14px;
    border: 1px solid rgba(230,106,106,.6);
    border-radius: 9px;
    background: rgba(120,20,20,.18);
    color: #ffd6d6;
    font-size: 14px;
}


/* Buttons */

.mch-btn {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border: 1px solid var(--green);
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.mch-btn-primary {
    background: var(--green);
    color: #050907;
}

.mch-btn-outline {
    background: transparent;
    color: var(--green);
}

.mch-btn:hover {
    filter: brightness(1.08);
}

.mch-btn:disabled {
    opacity: .6;
    cursor: wait;
}

.mch-btn-block {
    width: 100%;
    margin-top: 10px;
}


/* Topbar */

.mch-topbar {
    position: absolute;
    z-index: 1200;
    top: 0;
    left: 0;
    right: 0;
    min-height: 78px;
    display: grid;
    grid-template-columns: minmax(250px, 1fr) auto auto;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(80,217,38,.20);
    background: rgba(5,9,7,.96);
    backdrop-filter: blur(12px);
}

.mch-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.mch-logo {
    width: auto;
    height: 52px;
    max-width: 175px;
    object-fit: contain;
}

.mch-title {
    font-size: 19px;
    font-weight: 800;
}

.mch-subtitle {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.mch-modebar {
    display: flex;
    gap: 7px;
}

.mch-mode {
    min-height: 39px;
    padding: 8px 12px;
    border: 1px solid rgba(80,217,38,.7);
    border-radius: 8px;
    background: transparent;
    color: var(--green);
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}

.mch-mode.is-active,
.mch-mode:hover {
    background: var(--green);
    color: #050907;
}


/* Map */

.mch-map {
    position: absolute;
    z-index: 1;
    inset: 0;
    background: #172119;
}

.leaflet-control-zoom {
    margin-top: 92px !important;
}

.leaflet-control-attribution {
    font-size: 10px;
}


/* Panel */

.mch-panel {
    position: absolute;
    z-index: 1100;
    top: 94px;
    left: 16px;
    width: min(390px, calc(100vw - 32px));
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    padding: 16px;
    border: 1px solid rgba(80,217,38,.24);
    border-radius: 14px;
    background: rgba(12,18,16,.96);
    box-shadow: 0 16px 45px rgba(0,0,0,.42);
    backdrop-filter: blur(12px);
    transition: transform .2s ease, opacity .2s ease;
}

.mch-panel.is-hidden {
    transform: translateX(calc(-100% - 32px));
    opacity: 0;
    pointer-events: none;
}

.mch-panel-section + .mch-panel-section,
.mch-mode-panel + .mch-panel-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,.08);
}

.mch-mode-panel {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,.08);
}

.mch-panel-heading h2 {
    margin: 0 0 9px;
    font-size: 25px;
    line-height: 1.15;
}

.mch-panel-heading p {
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.mch-label,
.mch-mode-panel label > span,
.mch-field-grid label > span {
    display: block;
    margin-bottom: 7px;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
}

.mch-input {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 8px;
    outline: 0;
    background: #0E1711;
    color: var(--text);
}

.mch-input:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(80,217,38,.10);
}

.mch-search-row {
    display: grid;
    grid-template-columns: 1fr 44px;
    gap: 8px;
}

.mch-icon-btn {
    border: 1px solid var(--green);
    border-radius: 8px;
    background: var(--green);
    color: #050907;
    font-size: 23px;
    font-weight: 800;
    cursor: pointer;
}

.mch-search-results {
    margin-top: 8px;
    max-height: 230px;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 8px;
    background: #09100C;
}

.mch-search-result {
    width: 100%;
    padding: 10px 11px;
    border: 0;
    border-bottom: 1px solid rgba(255,255,255,.08);
    background: transparent;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.mch-search-result:last-child {
    border-bottom: 0;
}

.mch-search-result:hover {
    background: rgba(80,217,38,.08);
}

.mch-search-result strong,
.mch-search-result span {
    display: block;
}

.mch-search-result span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
}

.mch-switch {
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    font-size: 13px;
}

.mch-switch input {
    width: 18px;
    height: 18px;
    accent-color: var(--green);
}

.mch-coordinates {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--panel2);
    font-size: 12px;
}

.mch-coordinates span {
    color: var(--muted);
}

.mch-coordinates strong {
    text-align: right;
}

.mch-field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 11px;
}

.mch-unit-input {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 8px;
    background: #0E1711;
}

.mch-unit-input .mch-input {
    border: 0;
    border-radius: 0;
    background: transparent;
}

.mch-unit-input b {
    padding: 0 10px;
    color: var(--muted);
    font-size: 11px;
}

.mch-details {
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: rgba(17,26,22,.7);
}

.mch-details summary {
    color: var(--green);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.mch-details-grid {
    margin-top: 12px;
}

.mch-result {
    margin-top: 14px;
    padding: 12px 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--panel2);
    font-size: 13px;
    line-height: 1.55;
}

.mch-result strong {
    color: var(--text);
}

.mch-result .good {
    color: var(--green);
}

.mch-result .warn {
    color: var(--amber);
}

.mch-result .bad {
    color: var(--red);
}


/* Link points */

.mch-point-list {
    display: grid;
    gap: 9px;
    margin-bottom: 13px;
}

.mch-point-row {
    display: grid;
    grid-template-columns: 34px 1fr auto;
    align-items: center;
    gap: 9px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--panel2);
}

.mch-point-badge {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--green);
    color: #050907;
    font-weight: 900;
}

.mch-point-row small {
    display: block;
    color: var(--muted);
    font-size: 10px;
}

.mch-point-row strong {
    display: block;
    margin-top: 2px;
    font-size: 11px;
}

.mch-mini-unit {
    display: flex;
    align-items: center;
    gap: 4px;
}

.mch-mini-unit input {
    width: 58px;
    padding: 7px;
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 7px;
    background: #0E1711;
    color: var(--text);
}

.mch-mini-unit span {
    color: var(--muted);
    font-size: 10px;
}


/* Profile */

.mch-profile {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,.08);
}

.mch-profile-title {
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 800;
}

#profile-canvas {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #08100B;
}

.mch-profile-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 7px;
    color: var(--muted);
    font-size: 10px;
}

.mch-profile-legend span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.mch-profile-legend i {
    width: 14px;
    height: 3px;
    display: inline-block;
}

.mch-profile-legend .terrain {
    background: var(--green);
}

.mch-profile-legend .los {
    background: #FFFFFF;
}

.mch-profile-legend .fresnel {
    background: var(--amber);
}


/* Disclaimer */

.mch-disclaimer strong {
    font-size: 12px;
}

.mch-disclaimer p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
}


/* Loading */

.mch-loading {
    position: absolute;
    z-index: 4000;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: rgba(5,9,7,.80);
    backdrop-filter: blur(5px);
}

.mch-loading > div:last-child {
    display: grid;
    gap: 3px;
}

.mch-loading span {
    color: var(--muted);
    font-size: 12px;
}

.mch-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255,255,255,.20);
    border-top-color: var(--green);
    border-radius: 50%;
    animation: mch-spin .8s linear infinite;
}

@keyframes mch-spin {
    to { transform: rotate(360deg); }
}

.mch-map-hint {
    position: absolute;
    z-index: 1150;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    max-width: calc(100vw - 30px);
    padding: 10px 15px;
    border: 1px solid rgba(80,217,38,.35);
    border-radius: 999px;
    background: rgba(5,9,7,.92);
    color: var(--text);
    font-size: 12px;
    text-align: center;
}


/* Leaflet custom markers */

.mch-node-marker,
.mch-point-marker {
    display: grid;
    place-items: center;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 3px 10px rgba(0,0,0,.4);
    font-weight: 900;
}

.mch-node-marker {
    width: 24px;
    height: 24px;
    background: #50D926;
    color: #050907;
    font-size: 10px;
}

.mch-point-marker {
    width: 30px;
    height: 30px;
    background: #0C1210;
    color: #50D926;
    font-size: 12px;
}

.mch-point-marker.candidate {
    background: #50D926;
    color: #050907;
}

.mch-point-marker.critical {
    background: #E9B949;
    color: #050907;
}


/* Responsive */

@media (max-width: 1100px) {
    .mch-topbar {
        grid-template-columns: 1fr auto;
    }

    .mch-modebar {
        order: 3;
        grid-column: 1 / -1;
        overflow-x: auto;
        padding-top: 5px;
    }

    .mch-topbar {
        min-height: 120px;
    }

    .mch-panel {
        top: 136px;
        max-height: calc(100vh - 152px);
    }

    .leaflet-control-zoom {
        margin-top: 134px !important;
    }
}

@media (max-width: 767px) {

    .mch-consent {
        padding: 14px;
    }

    .mch-consent-card {
        padding: 28px 18px;
    }

    .mch-consent-actions {
        flex-direction: column;
    }

    .mch-consent-actions .mch-btn {
        width: 100%;
    }

    .mch-topbar {
        min-height: 116px;
        padding: 8px 10px;
    }

    .mch-logo {
        height: 42px;
        max-width: 120px;
    }

    .mch-title {
        font-size: 15px;
    }

    .mch-subtitle {
        display: none;
    }

    .mch-panel-toggle {
        min-height: 38px;
        padding: 7px 10px;
    }

    .mch-mode {
        white-space: nowrap;
    }

    .mch-panel {
        top: 128px;
        left: 10px;
        width: calc(100vw - 20px);
        max-height: calc(100dvh - 140px);
    }

    .leaflet-control-zoom {
        margin-top: 124px !important;
    }

    .mch-field-grid {
        grid-template-columns: 1fr;
    }

    .mch-map-hint {
        bottom: 14px;
    }
}


/* V1.3.0 – Umkreissuche */
.mch-auto-info {
    margin: 12px 0;
    padding: 13px 14px;
    border: 1px solid #1D2923;
    border-radius: 10px;
    background: #111A16;
}
.mch-auto-info strong {
    display: block;
    margin-bottom: 5px;
    color: #50D926;
    font-size: 13px;
}
.mch-auto-info p {
    margin: 0;
    color: #A8B0AC;
    font-size: 12px;
    line-height: 1.5;
}
