:root {
    --mc-bg: #050907;
    --mc-panel: rgba(5, 9, 7, 0.94);
    --mc-panel-soft: rgba(12, 20, 15, 0.94);
    --mc-border: rgba(80, 217, 38, 0.26);
    --mc-green: #50D926;
    --mc-green-dark: #2f9f17;
    --mc-text: #f4f7f4;
    --mc-muted: #aab7ad;
    --mc-shadow: 0 12px 34px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

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

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

.mc-app {
    position: relative;
}

#mc-map {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: #18211b;
}

.mc-topbar {
    position: absolute;
    z-index: 1100;
    top: 0;
    left: 0;
    right: 0;
    height: 78px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: linear-gradient(180deg, rgba(5,9,7,.98), rgba(5,9,7,.88));
    border-bottom: 1px solid var(--mc-border);
    backdrop-filter: blur(10px);
}

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

.mc-logo {
    display: block;
    width: auto;
    height: 54px;
    max-width: 180px;
    object-fit: contain;
}

.mc-title {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.15;
}

.mc-subtitle {
    margin-top: 4px;
    color: var(--mc-muted);
    font-size: 12px;
    line-height: 1.25;
}

.mc-panel {
    position: absolute;
    z-index: 1050;
    top: 94px;
    left: 16px;
    width: min(360px, calc(100vw - 32px));
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    padding: 14px;
    border: 1px solid var(--mc-border);
    border-radius: 12px;
    background: var(--mc-panel);
    box-shadow: var(--mc-shadow);
    backdrop-filter: blur(12px);
    transition: transform .2s ease, opacity .2s ease;
}

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

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

.mc-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 700;
}

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

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

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

.mc-icon-button,
.mc-button {
    border: 1px solid var(--mc-green);
    border-radius: 8px;
    cursor: pointer;
    background: var(--mc-green);
    color: #061004;
    font-weight: 700;
}

.mc-icon-button {
    min-width: 42px;
    font-size: 24px;
}

.mc-button {
    min-height: 42px;
    padding: 9px 13px;
}

.mc-button:hover,
.mc-icon-button:hover {
    filter: brightness(1.08);
}

.mc-button-secondary {
    background: #0d1710;
    color: var(--mc-text);
}

.mc-check {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 8px 0;
    cursor: pointer;
    font-size: 14px;
}

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

.mc-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.mc-stats {
    display: grid;
    gap: 5px;
    color: var(--mc-muted);
    font-size: 12px;
}

.mc-stats strong {
    color: var(--mc-text);
}

.mc-status {
    margin-top: 4px;
}

.mc-search-results {
    margin-top: 8px;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 8px;
    background: #0a100c;
}

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

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

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

.mc-search-result-name {
    font-weight: 700;
}

.mc-search-result-key {
    margin-top: 2px;
    overflow: hidden;
    color: var(--mc-muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mc-loading {
    position: absolute;
    z-index: 2000;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: rgba(5,9,7,.78);
    color: white;
    backdrop-filter: blur(4px);
}

.mc-loading[hidden] {
    display: none;
}

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

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

.mc-node-marker {
    display: grid;
    place-items: center;
    width: 30px !important;
    height: 30px !important;
    margin-left: -15px !important;
    margin-top: -15px !important;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 3px 10px rgba(0,0,0,.38);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
}

.mc-node-1 { background: #2271b1; }
.mc-node-2 { background: #50D926; color: #061004; }
.mc-node-3 { background: #8b5cf6; }
.mc-node-4 { background: #e49b20; color: #13100a; }

.mc-popup {
    min-width: 260px;
    line-height: 1.4;
}

.mc-popup h3 {
    margin: 0 0 8px;
    font-size: 17px;
}

.mc-popup-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.mc-popup-table td {
    padding: 4px 0;
    vertical-align: top;
    border-bottom: 1px solid rgba(0,0,0,.08);
}

.mc-popup-table td:first-child {
    width: 42%;
    padding-right: 8px;
    font-weight: 700;
}

.mc-popup-key {
    word-break: break-all;
}

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

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

@media (max-width: 800px) {
    .mc-topbar {
        height: 70px;
        padding: 8px 10px;
    }

    .mc-logo {
        height: 46px;
        max-width: 132px;
    }

    .mc-title {
        font-size: 16px;
    }

    .mc-subtitle {
        display: none;
    }

    .mc-panel {
        top: 82px;
        left: 10px;
        width: calc(100vw - 20px);
        max-height: calc(100dvh - 94px);
    }

    .mc-actions {
        grid-template-columns: 1fr;
    }

    .leaflet-control-layers,
    .leaflet-control-zoom {
        margin-top: 80px !important;
    }
}
