.app-header {
    height: 52px;
    width: 100%;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    flex-shrink: 0;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
}
.logo {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--accent);
}
.logo span {
    font-size: 0.7rem;
    background: var(--bg-subtle);
    color: var(--text-muted);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 4px;
}

#canvas-container {
    flex: 1;
    width: 100%;
    height: calc(100% - 52px);
    position: relative;
    overflow: hidden;
    touch-action: none;
    cursor: grab;
}
#canvas-container:active {
    cursor: grabbing;
}

.overlay-panel {
    position: absolute;
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    z-index: 20;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.panel-route {
    top: 66px;
    left: 14px;
    width: 348px;
    max-height: calc(100vh - 122px);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.viewer-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    background: var(--bg-subtle);
    padding: 3px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.viewer-tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.viewer-tab.active {
    background: var(--accent);
    color: #0b1329;
}

.tab-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}

.search-input-row {
    display: flex;
    gap: 4px;
    align-items: center;
}

.search-input-row .text-input {
    flex: 1;
    min-width: 0;
    font-size: 0.8rem;
}

.category-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.chip-btn {
    border: 1px solid var(--border);
    background: var(--bg-subtle);
    color: var(--text-main);
    font-size: 0.7rem;
    padding: 3px 7px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.chip-btn:hover {
    border-color: var(--accent);
}

.chip-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #0b1329;
    font-weight: 700;
}

.search-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 310px;
    overflow-y: auto;
    padding-right: 2px;
}

.search-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: var(--bg-subtle);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.12s, background 0.12s;
}

.search-item:hover,
.search-item.active {
    border-color: var(--accent);
    background: rgba(56, 189, 248, 0.12);
}

.search-item-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-item-sub {
    font-size: 0.68rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-item-badge {
    font-size: 0.66rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Маршрутизация (T2-05) */
.route-form {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.route-select-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.route-pin {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    flex-shrink: 0;
    color: #fff;
}

.route-pin-a {
    background: #10b981;
}

.route-pin-b {
    background: #ef4444;
}

.route-status {
    font-size: 0.74rem;
    color: var(--text-muted);
}

.route-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid var(--border);
    padding-top: 8px;
    max-height: 280px;
    overflow-y: auto;
}

.route-metrics {
    display: flex;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--accent);
}

.route-segments {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.route-segment-btn {
    border: 1px solid var(--border);
    background: var(--bg-subtle);
    color: var(--text-main);
    border-radius: 6px;
    padding: 4px 7px;
    font-size: 0.7rem;
    cursor: pointer;
}

.route-segment-btn.active,
.route-segment-btn:hover {
    border-color: var(--accent);
    background: rgba(56, 189, 248, 0.18);
}

.route-steps {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.route-step-item {
    font-size: 0.73rem;
    color: var(--text-main);
    padding: 4px 6px;
    border-radius: 6px;
    background: var(--bg-subtle);
    line-height: 1.3;
}

/* Карточка объекта (T2-04) */
.object-card {
    bottom: 52px;
    right: 16px;
    width: 310px;
    max-height: 360px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    z-index: 25;
}

.object-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.object-card-type {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--accent);
    font-weight: 700;
}

.object-card-title {
    font-size: 0.92rem;
    color: var(--text-main);
    margin: 2px 0 0 0;
    line-height: 1.25;
}

.object-card-subtitle {
    font-size: 0.74rem;
    color: var(--text-muted);
}

.object-card-floors {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.object-card-rooms {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-height: 120px;
    overflow-y: auto;
    border-top: 1px solid var(--border);
    padding-top: 6px;
}

.object-card-room-row {
    font-size: 0.73rem;
    padding: 4px 6px;
    border-radius: 6px;
    background: var(--bg-subtle);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    gap: 6px;
}

.object-card-room-row:hover {
    background: rgba(56, 189, 248, 0.18);
}

.object-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 2px;
}

/* Лифтовая панель этажей */
.panel-slice {
    top: 66px;
    right: 16px;
    width: 190px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#floor-buttons {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 260px;
    overflow-y: auto;
    padding-right: 2px;
}

#floor-buttons .btn {
    width: 100%;
    justify-content: center;
    text-align: center;
    padding: 6px 8px;
    font-size: 0.78rem;
}

.hud-status {
    position: absolute;
    bottom: 12px;
    left: 14px;
    right: 16px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    z-index: 20;
}

.hud-status span {
    background: var(--bg-panel);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.73rem;
    font-family: monospace;
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    .app-header {
        padding: 0 10px;
        height: 48px;
    }
    .logo span {
        display: none;
    }
    .hide-mobile {
        display: none !important;
    }
    .hud-status {
        display: none;
    }

    .panel-route {
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-height: 45vh;
        border-radius: 16px 16px 0 0;
        padding: 12px 14px 16px 14px;
        box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
    }

    .object-card {
        left: 10px;
        right: 10px;
        bottom: auto;
        top: 58px;
        width: auto;
    }

    .panel-slice {
        top: auto;
        right: 10px;
        bottom: 47vh;
        width: auto;
        max-width: 140px;
        padding: 8px;
    }
    .panel-slice label,
    .panel-slice select {
        display: none !important;
    }
    #floor-buttons {
        max-height: 150px;
    }
}
