:root {
    --cladiri-ink: #172033;
    --cladiri-muted: #687083;
    --cladiri-line: #e6e9ef;
    --cladiri-panel: rgba(255, 255, 255, 0.96);
    --cladiri-accent: #c92874;
    --cladiri-accent-soft: #f9e8f0;
    --cladiri-shadow: 0 12px 36px rgba(20, 27, 43, 0.18);
}

* {
    box-sizing: border-box;
}

.cladiri-ro-body {
    margin: 0;
    overflow: hidden;
    color: var(--cladiri-ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.cladiri-ro-shell {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    background: #eef1f4;
}

.cladiri-ro-map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.cladiri-ro-map.cursor-pointer {
    cursor: pointer;
}

.cladiri-ro-map.is-loading::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 20;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid rgba(255, 255, 255, 0.92);
    border-top-color: var(--cladiri-accent);
    border-radius: 50%;
    animation: cladiri-spin 0.8s linear infinite;
    pointer-events: none;
}

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

.ol-attribution {
    right: 0.65rem;
    bottom: 0.55rem;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.82);
    font-size: 11px;
}

.ol-attribution button {
    display: none !important;
}

.cladiri-home-link {
    position: absolute;
    left: 16px;
    top: 16px;
    z-index: 50;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 7px 12px 7px 8px;
    color: var(--cladiri-ink);
    text-decoration: none;
    background: var(--cladiri-panel);
    border: 1px solid rgba(230, 233, 239, 0.9);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(20, 27, 43, 0.16);
    backdrop-filter: blur(10px);
}

.cladiri-home-link:hover {
    color: var(--cladiri-ink);
    background: #fff;
    box-shadow: var(--cladiri-shadow);
}

.cladiri-home-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    font-size: 14px;
    line-height: 1;
    color: var(--cladiri-muted);
}

.cladiri-home-link img {
    width: 26px;
    height: 26px;
    object-fit: contain;
    border-radius: 5px;
}

.cladiri-home-text {
    display: flex;
    flex-direction: column;
    line-height: 1.08;
}

.cladiri-home-text span {
    font-size: 10px;
    font-weight: 600;
    color: var(--cladiri-muted);
}

.cladiri-home-text strong {
    font-size: 13px;
    color: var(--cladiri-ink);
}

.map-toolbar {
    position: absolute;
    right: 16px;
    bottom: 40px;
    z-index: 45;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 6px;
    /* reset moșteniri de la theme.css .map-toolbar (alt component, același
       nume): sub 992px acela pune width:100% + space-between și întinde
       toolbar-ul hărții pe toată lățimea ecranului. */
    width: auto;
    justify-content: flex-start;
    background: var(--cladiri-panel);
    border: 1px solid rgba(230, 233, 239, 0.9);
    border-radius: 10px;
    box-shadow: var(--cladiri-shadow);
    backdrop-filter: blur(10px);
}

.map-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #394153;
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
}

.map-tool-btn i {
    pointer-events: none;
}

.map-tool-btn:hover,
.map-tool-btn.active {
    background: #f1f3f7;
    color: var(--cladiri-ink);
}

.map-tool-btn-accent {
    color: var(--cladiri-accent);
}

.map-tool-divider {
    height: 1px;
    margin: 2px 4px;
    background: var(--cladiri-line);
}

#btnNorth.rotated {
    color: #c43b2b;
    background: #fbe9e7;
}

#northArrowGroup {
    transition: transform 0.18s ease;
}

.analysis-panel {
    position: absolute;
    right: 72px;
    bottom: 40px;
    z-index: 46;
    width: 300px;
    overflow: hidden;
    background: var(--cladiri-panel);
    border: 1px solid rgba(230, 233, 239, 0.92);
    border-radius: 10px;
    box-shadow: var(--cladiri-shadow);
    backdrop-filter: blur(10px);
}

.analysis-panel[hidden] {
    display: none;
}

.analysis-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 14px;
    background: #1f2937;
    color: #fff;
}

.analysis-panel-header h2 {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 13px;
    font-weight: 750;
}

.panel-close-btn,
.popup-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    color: inherit;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
}

.panel-close-btn:hover,
.popup-close-btn:hover {
    background: rgba(255, 255, 255, 0.28);
}

.analysis-panel-body {
    padding: 7px;
}

.analysis-option {
    display: grid;
    grid-template-columns: 34px 1fr 18px;
    gap: 10px;
    align-items: center;
    width: 100%;
    padding: 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--cladiri-ink);
    cursor: pointer;
    text-align: left;
}

.analysis-option:hover {
    background: #f5f6f9;
}

.analysis-option.active {
    background: var(--cladiri-accent-soft);
}

.analysis-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #eef1f6;
    font-size: 17px;
}

.analysis-option.active .analysis-icon {
    background: var(--cladiri-accent);
    color: #fff;
}

.analysis-label {
    display: block;
    font-size: 13px;
    font-weight: 750;
}

.analysis-desc {
    display: block;
    margin-top: 2px;
    color: var(--cladiri-muted);
    font-size: 11px;
}

.analysis-check {
    color: var(--cladiri-accent);
    font-weight: 800;
    opacity: 0;
}

.analysis-option.active .analysis-check {
    opacity: 1;
}

.map-legend {
    position: absolute;
    left: 16px;
    bottom: 40px;
    z-index: 44;
    width: min(330px, calc(100vw - 96px));
    padding: 14px;
    background: var(--cladiri-panel);
    border: 1px solid rgba(230, 233, 239, 0.92);
    border-radius: 10px;
    box-shadow: var(--cladiri-shadow);
    backdrop-filter: blur(10px);
    max-height: calc(100vh - 110px);
    overflow: auto;
    /* reset moșteniri de la theme.css .map-legend (display:flex / gap / margin) */
    display: block;
    gap: 0;
    margin-top: 0;
}

.map-legend.has-chart {
    width: min(380px, calc(100vw - 96px));
}

.legend-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 11px;
    border-bottom: 1px solid var(--cladiri-line);
}

.legend-kicker {
    display: block;
    margin-bottom: 3px;
    color: var(--cladiri-muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.legend-header h2 {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 0;
    font-size: 14px;
    line-height: 1.2;
}

.legend-header h2 i {
    color: var(--cladiri-accent);
    font-size: 13px;
}

.legend-chart-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border: 0;
    border-radius: 8px;
    background: #f2f4f7;
    color: #4b5563;
    cursor: pointer;
    font-size: 14px;
}

.legend-chart-btn:hover,
.legend-chart-btn.active {
    background: var(--cladiri-accent-soft);
    color: var(--cladiri-accent);
}

.legend-stats {
    display: grid;
    gap: 5px;
    padding: 11px 0;
    border-bottom: 1px dashed var(--cladiri-line);
}

.stats-row,
.legend-item,
.chart-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 12.5px;
}

.stats-key,
.legend-label,
.chart-label {
    color: var(--cladiri-muted);
}

.stats-val,
.legend-count,
.chart-value {
    color: var(--cladiri-ink);
    font-weight: 750;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.legend-items {
    display: grid;
    gap: 7px;
    padding-top: 11px;
}

.legend-item {
    justify-content: flex-start;
}

.legend-swatch {
    width: 24px;
    height: 15px;
    flex: 0 0 auto;
    border: 1px solid rgba(23, 32, 51, 0.22);
    border-radius: 4px;
}

.legend-label {
    flex: 1;
    min-width: 0;
}

.legend-count {
    min-width: 42px;
    text-align: right;
}

.legend-chart {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid var(--cladiri-line);
    border-radius: 8px;
    background: #f8fafc;
}

.legend-chart[hidden] {
    display: none;
}

.chart-title {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0 0 10px;
    color: #4b5563;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.chart-title i {
    color: var(--cladiri-accent);
}

.chart-svg {
    display: block;
    width: 100%;
    height: auto;
}

.chart-table {
    display: grid;
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--cladiri-line);
}

.chart-dot {
    width: 10px;
    height: 10px;
    flex: 0 0 auto;
    border: 1px solid rgba(23, 32, 51, 0.2);
    border-radius: 3px;
}

.chart-label {
    flex: 1;
    min-width: 0;
}

.chart-empty {
    padding: 16px 4px;
    color: var(--cladiri-muted);
    font-size: 12px;
    font-style: italic;
    text-align: center;
}

.chart-kpis {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    margin-top: 10px;
}

.chart-kpi {
    min-width: 0;
    padding: 8px 6px;
    border: 1px solid var(--cladiri-line);
    border-radius: 7px;
    background: #fff;
    text-align: center;
}

.chart-kpi strong {
    display: block;
    color: var(--cladiri-accent);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.chart-kpi span {
    display: block;
    margin-top: 3px;
    color: var(--cladiri-muted);
    font-size: 9.5px;
    font-weight: 750;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.building-popup {
    min-width: 260px;
    max-width: 340px;
    overflow: hidden;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.28);
}

.building-popup[hidden] {
    display: none;
}

.popup-close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    background: rgba(255, 255, 255, 0.24);
    color: #fff;
}

.popup-head {
    padding: 14px 42px 14px 16px;
    color: #fff;
}

.popup-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 14px;
    line-height: 1.25;
}

.popup-subtitle {
    display: block;
    margin-top: 3px;
    font-size: 11px;
    opacity: 0.86;
}

.popup-body {
    padding: 10px 16px 14px;
}

.popup-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 7px 0;
    border-bottom: 1px dashed #edf0f4;
    font-size: 13px;
}

.popup-row:last-child {
    border-bottom: 0;
}

.popup-key {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--cladiri-muted);
    font-weight: 650;
    white-space: nowrap;
}

.popup-key i {
    width: 14px;
    color: #8b94a6;
    text-align: center;
}

.popup-val {
    color: var(--cladiri-ink);
    font-weight: 700;
    text-align: right;
    word-break: break-word;
}

@media (max-width: 720px) {
    .cladiri-home-link {
        top: 10px;
        left: 10px;
    }

    .map-toolbar {
        right: 10px;
        bottom: 20px;
    }

    .map-legend {
        left: 10px;
        bottom: 20px;
        width: min(310px, calc(100vw - 76px));
        max-height: 58vh;
        overflow: auto;
    }

    .map-legend.has-chart {
        width: min(340px, calc(100vw - 76px));
    }

    .analysis-panel {
        right: 62px;
        bottom: 20px;
        width: min(292px, calc(100vw - 82px));
    }
}
