:root {
    --bg: #07111d;
    --panel: #0b1624;
    --panel2: #0e1b2d;
    --border: rgba(139, 188, 224, .18);
    --text: #eef7ff;
    --muted: #8da2b8;
    --green: #24e0a4;
    --green2: #0fbf88;
    --cyan: #22d3ee;
    --danger: #ef4444;
    --shadow: 0 18px 40px rgba(0,0,0,.35);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, Segoe UI, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
}

.app-shell {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(34,211,238,.12), transparent 28%),
        radial-gradient(circle at top right, rgba(36,224,164,.12), transparent 25%),
        #07111d;
}

.topbar {
    height: 76px;
    display: grid;
    grid-template-columns: 360px 1fr 360px;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--border);
    background: rgba(5, 14, 25, .92);
    backdrop-filter: blur(18px);
}

.topbar-left,
.topbar-user,
.topnav {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topnav {
    justify-content: center;
}

.icon-btn {
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #081525;
    color: var(--text);
    font-size: 20px;
    position: relative;
}

.badge-dot {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--green);
    color: #062015;
    font-size: 11px;
    font-weight: 800;
    border-radius: 999px;
    padding: 2px 6px;
}

.brand-logo {
    width: 50px;
    height: 50px;
    border: 1px solid rgba(36,224,164,.55);
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: var(--green);
    font-weight: 900;
    font-size: 22px;
    background: rgba(36,224,164,.08);
}

.brand-text h1 {
    margin: 0;
    font-size: 21px;
    line-height: 1.1;
}

.brand-text span,
.user-meta span {
    color: var(--muted);
    font-size: 13px;
}

.nav-pill {
    color: var(--text);
    text-decoration: none;
    padding: 16px 28px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #081525;
    font-weight: 800;
    text-transform: uppercase;
}

.nav-pill.active {
    background: linear-gradient(135deg, var(--green), #30d5c8);
    color: #042016;
    box-shadow: 0 0 25px rgba(36,224,164,.25);
}

.avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #cbd5e1;
    color: #0f172a;
    display: grid;
    place-items: center;
    font-weight: 900;
}

.user-meta strong {
    display: block;
    font-size: 15px;
}

.logout-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 22px;
}

.layout {
    display: grid;
    grid-template-columns: 300px 1fr 420px;
    gap: 12px;
    padding: 12px;
}

.sidebar,
.right-panel,
.main-content {
    min-height: calc(100vh - 115px);
}

.filter-card,
.info-card,
.stats-card,
.qr-card,
.map-card,
.preview-card,
.floor-card,
.side-menu {
    background: rgba(11, 22, 36, .92);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.filter-card {
    padding: 22px;
}

.filter-card h3,
.info-card h3,
.stats-card h3,
.qr-card h3,
.preview-card h3,
.floor-card h3 {
    margin: 0 0 16px;
    text-transform: uppercase;
    font-size: 16px;
    color: #dbeafe;
}

.search-box {
    position: relative;
    margin-bottom: 24px;
}

.search-box input,
select {
    width: 100%;
    height: 48px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #071322;
    color: var(--text);
    padding: 0 16px;
    font-size: 14px;
    outline: none;
}

.search-box i {
    position: absolute;
    right: 14px;
    top: 14px;
    color: var(--muted);
}

.filter-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-title button {
    background: none;
    border: 0;
    color: var(--muted);
    cursor: pointer;
}

.filter-card select {
    margin-bottom: 12px;
}

.btn-primary {
    border: 0;
    border-radius: 9px;
    height: 52px;
    background: linear-gradient(135deg, var(--green), #2bd9bc);
    color: #041d14;
    font-weight: 900;
    text-transform: uppercase;
    cursor: pointer;
}

.btn-primary.full {
    width: 100%;
    margin-top: 20px;
}

.btn-outline {
    border: 1px solid rgba(36,224,164,.55);
    color: var(--green);
    background: transparent;
    border-radius: 9px;
    height: 46px;
    font-weight: 800;
    cursor: pointer;
}

.side-menu {
    margin-top: 10px;
    overflow: hidden;
}

.side-menu button {
    width: 100%;
    height: 58px;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 0;
    border-left: 4px solid transparent;
    background: transparent;
    color: #cbd5e1;
    padding: 0 24px;
    font-weight: 800;
    text-align: left;
    cursor: pointer;
}

.side-menu button i {
    font-size: 22px;
}

.side-menu button.active {
    background: rgba(36,224,164,.09);
    border-left-color: var(--green);
    color: var(--text);
}

.map-card {
    height: 520px;
    position: relative;
    overflow: hidden;
}

#map {
    height: 100%;
    width: 100%;
    background: #111827;
}

.layer-panel {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 250px;
    background: rgba(6, 16, 29, .92);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 15px;
    z-index: 800;
    backdrop-filter: blur(12px);
}

.layer-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 14px;
    text-transform: uppercase;
}

.layer-panel label {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    color: #cbd5e1;
}

.layer-panel input {
    accent-color: var(--green);
}

.building-label {
    background: rgba(8, 17, 30, .82);
    color: white;
    border: 0;
    border-radius: 6px;
    padding: 6px 9px;
    font-weight: 800;
    text-align: center;
}

.bottom-grid {
    display: grid;
    grid-template-columns: 1fr 330px;
    gap: 12px;
    margin-top: 12px;
}

.preview-card,
.floor-card {
    min-height: 310px;
    padding: 18px;
}

.preview-body {
    position: relative;
    min-height: 245px;
    background:
        linear-gradient(135deg, rgba(15,23,42,.4), rgba(36,224,164,.07));
    border-radius: 10px;
    overflow: hidden;
}

.floor-tabs {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 2;
    display: grid;
    gap: 6px;
}

.floor-tabs button {
    width: 90px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #0b1624;
    color: #cbd5e1;
    text-transform: uppercase;
}

.floor-tabs button.active {
    color: var(--green);
    border-color: var(--green);
}

.building-visual {
    height: 245px;
    display: grid;
    place-items: center;
}

.mock-building {
    font-size: 110px;
    color: rgba(36,224,164,.65);
    filter: drop-shadow(0 0 35px rgba(36,224,164,.25));
}

.viewer-tools {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    background: rgba(8, 17, 30, .88);
    padding: 8px;
    border-radius: 12px;
}

.viewer-tools button {
    border: 0;
    background: transparent;
    color: #cbd5e1;
    padding: 8px 10px;
    cursor: pointer;
}

.floor-plan {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin: 18px auto;
    max-width: 240px;
}

.floor-plan div {
    height: 28px;
    background: #334155;
    border: 1px solid #94a3b8;
    border-radius: 3px;
}

.floor-plan .classroom { background: #10b981; }
.floor-plan .lab { background: #2563eb; }
.floor-plan .office { background: #7c3aed; }
.floor-plan .facility { background: #f59e0b; }

.legend {
    display: grid;
    gap: 7px;
    color: #cbd5e1;
    font-size: 13px;
}

.legend b {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    margin-right: 8px;
}

.green { background: #10b981; }
.blue { background: #2563eb; }
.purple { background: #7c3aed; }
.yellow { background: #f59e0b; }

.right-panel {
    display: grid;
    gap: 12px;
    align-content: start;
}

.info-card,
.stats-card,
.qr-card {
    padding: 20px;
}

.muted {
    color: var(--muted);
}

.building-photo {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 16px;
    align-items: center;
}

.photo-placeholder {
    height: 110px;
    border-radius: 8px;
    background:
        linear-gradient(135deg, #7c2d12 0 25%, #cbd5e1 25% 55%, #1f2937 55% 100%);
}

.building-photo h2 {
    margin: 0 0 6px;
    font-size: 20px;
}

.building-photo p {
    margin: 0;
    color: var(--muted);
}

.info-list {
    margin-top: 18px;
}

.info-list div {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(148,163,184,.12);
    color: var(--muted);
}

.info-list strong {
    color: #dbeafe;
}

.status-pill {
    color: var(--green) !important;
    border: 1px solid rgba(36,224,164,.5);
    border-radius: 6px;
    padding: 2px 10px;
}

.two-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.stat-box {
    border: 1px solid var(--border);
    border-radius: 10px;
    min-height: 95px;
    display: grid;
    place-items: center;
    text-align: center;
    background: #0b1624;
}

.stat-box i {
    font-size: 28px;
    color: var(--green);
}

.stat-box strong {
    color: var(--green);
    font-size: 24px;
}

.stat-box span {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.qr-wrap {
    display: grid;
    grid-template-columns: 1fr 120px;
    gap: 16px;
    align-items: center;
}

.qr-wrap p {
    color: #9cc8e8;
}

.qr-box {
    width: 110px;
    height: 110px;
    border-radius: 10px;
    background: #e5e7eb;
    color: #111827;
    display: grid;
    place-items: center;
    font-size: 72px;
}

.footer {
    height: 38px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    padding: 10px 24px;
    color: var(--muted);
    font-size: 12px;
}

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

@media (max-width: 1300px) {
    .layout {
        grid-template-columns: 280px 1fr;
    }

    .right-panel {
        grid-column: 1 / -1;
        grid-template-columns: repeat(3, 1fr);
        min-height: auto;
    }

    .topbar {
        grid-template-columns: 320px 1fr;
    }

    .topbar-user {
        display: none;
    }
}

@media (max-width: 900px) {
    .layout,
    .bottom-grid,
    .right-panel {
        grid-template-columns: 1fr;
    }

    .topbar {
        grid-template-columns: 1fr;
        height: auto;
        gap: 12px;
        padding: 16px;
    }

    .topnav {
        justify-content: flex-start;
        overflow-x: auto;
    }

    .map-card {
        height: 430px;
    }
}