.app-body {
    background: #171b24;
    color: #eef2f8;
    min-height: 100vh;
}

.app-main {
    min-height: 100vh;
}

.app-brand {
    color: #f8f9fa;
    font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
    font-size: 1.45rem;
    letter-spacing: 0;
    line-height: 1;
    text-transform: uppercase;
}

.app-brand-login {
    color: #f8f9fa;
    font-size: 2rem;
}

.app-navbar-logo {
    filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .18));
}

.app-navbar {
    background: #1d2330;
    border-bottom: 1px solid #303746;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .18);
}

.app-navbar .navbar-text {
    color: #c7cfdd;
}

.app-navbar .nav-link {
    color: #c7cfdd;
}

.app-navbar .nav-link.active,
.app-navbar .nav-link:focus,
.app-navbar .nav-link:hover {
    color: #ffffff;
}

.app-navbar .navbar-toggler {
    border-color: #546075;
}

.app-navbar .navbar-toggler:focus {
    box-shadow: 0 0 0 .15rem rgba(111, 127, 153, .35);
}

.app-navbar .btn-outline-primary,
.app-navbar .btn-outline-light {
    border-color: #546075;
    color: #e8edf6;
}

.app-navbar .btn-outline-primary:focus,
.app-navbar .btn-outline-primary:hover,
.app-navbar .btn-outline-light:focus,
.app-navbar .btn-outline-light:hover {
    background: #334055;
    border-color: #6f7f99;
    color: #ffffff;
}

.app-login-logo {
    display: block;
    filter: drop-shadow(0 1rem 1.5rem rgba(0, 0, 0, .3));
    height: 6.25rem;
    object-fit: contain;
    width: 6.25rem;
}

.app-shell {
    background:
        linear-gradient(180deg, rgba(47, 56, 76, .26), rgba(23, 27, 36, 0) 18rem),
        #171b24;
    min-height: calc(100vh - 4.25rem);
}

.app-eyebrow {
    color: #8ca9ff;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.app-page-title {
    color: #f8f9fa;
    font-size: clamp(1.75rem, 3vw, 2.4rem);
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.1;
    margin: .25rem 0 0;
}

.app-panel,
.app-empty-state {
    background: #202632;
    border: 1px solid #303746;
    box-shadow: 0 16px 32px rgba(0, 0, 0, .18);
    color: #f8f9fa;
    padding: clamp(1rem, 2vw, 1.35rem);
}

.form-control[readonly],
.form-control:disabled,
.form-select:disabled {
    background-color: #2b3240;
    border-color: #465166;
    color: #9faabc;
    opacity: 1;
}

.app-empty-state {
    max-width: 34rem;
}

.app-empty-state p {
    color: #aeb8ca;
    margin: 1rem 0 1.25rem;
}

.app-map-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1fr) minmax(18rem, 24rem);
    min-height: calc(100vh - 7rem);
}

.app-map-grid.devices-hidden {
    grid-template-columns: minmax(0, 1fr);
}

.app-map-stage {
    background: #202632;
    border: 1px solid #303746;
    min-height: 34rem;
    overflow: hidden;
    position: relative;
}

.app-map-show-devices {
    left: 1rem;
    position: absolute;
    top: 3.6rem;
    z-index: 3;
}

.app-map {
    background: #111827;
    cursor: grab;
    height: 100%;
    min-height: 34rem;
    overflow: hidden;
    position: relative;
    width: 100%;
}

.app-map.panning {
    cursor: grabbing;
}

.app-map-tile-layer {
    inset: 0;
    position: absolute;
    user-select: none;
}

.app-map-tile {
    height: 256px;
    position: absolute;
    width: 256px;
}

.app-map-marker-layer,
.app-map-popup-layer,
.app-map-placement-layer {
    inset: 0;
    pointer-events: none;
    position: absolute;
}

.app-map-marker {
    border: 2px solid #111827;
    border-radius: 999px;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .85), 0 8px 18px rgba(0, 0, 0, .35);
    cursor: pointer;
    height: 1.15rem;
    pointer-events: auto;
    position: absolute;
    transform: translate(-50%, -50%);
    width: 1.15rem;
}

.app-map-marker.type-gateway {
    background: #00a36c;
}

.app-map-marker.type-repeater {
    background: #f0ad4e;
}

.app-map-marker.type-torch {
    background: #d9534f;
}

.app-map-marker.type-chimera {
    background: #d97706;
}

.app-map-marker.pending {
    animation: app-map-pulse 1s infinite;
}

.app-map-marker.lost {
    background: #6c757d;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .65), 0 8px 18px rgba(0, 0, 0, .35);
}

.app-map-marker.warning {
    box-shadow: 0 0 0 2px rgba(255, 193, 7, .95), 0 8px 18px rgba(0, 0, 0, .35);
}

.app-map-popup-wrap {
    left: 50%;
    pointer-events: auto;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 4;
}

.app-map-placement-wrap {
    pointer-events: auto;
    position: absolute;
    transform: translate(-.5rem, .5rem);
    z-index: 5;
}

.app-map-placement-menu {
    background: #ffffff;
    border: 1px solid #cfd6e3;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .35);
    color: #111827;
    max-width: min(20rem, calc(100vw - 2rem));
    min-width: 15rem;
    padding: .65rem;
}

.app-map-placement-caption {
    color: #111827;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 .5rem;
}

.app-map-placement-search {
    margin-bottom: .5rem;
}

.app-map-placement-devices {
    max-height: min(18rem, calc(100vh - 14rem));
    overflow-y: auto;
}

.app-map-placement-device {
    align-items: center;
    background: transparent;
    border: 0;
    color: #111827;
    display: grid;
    gap: .3rem .5rem;
    grid-template-columns: auto minmax(0, 1fr);
    padding: .45rem;
    text-align: left;
    width: 100%;
}

.app-map-placement-device:focus,
.app-map-placement-device:hover {
    background: #edf2f7;
}

.app-map-placement-device small {
    color: #4b5563;
    grid-column: 2;
}

.app-map-placement-empty {
    color: #4b5563;
    padding: .35rem .45rem;
}

.app-map-controls {
    display: grid;
    gap: .35rem;
    position: absolute;
    right: 1rem;
    top: 1rem;
    z-index: 3;
}

.app-map-layer-switch {
    left: 1rem;
    position: absolute;
    top: 1rem;
    z-index: 3;
}

.app-map-layer-switch .btn {
    border-radius: 2px;
    font-weight: 700;
}

.app-map-layer-switch .btn.active {
    background: #4f79df;
    border-color: #4f79df;
    color: #ffffff;
}

.app-map-controls .btn {
    border-radius: 2px;
    font-weight: 700;
    min-width: 2.25rem;
}

.app-map-events {
    display: grid;
    gap: .5rem;
    pointer-events: none;
    position: fixed;
    right: 1rem;
    top: 5rem;
    z-index: 1100;
}

.app-map-event {
    background: rgba(32, 38, 50, .96);
    border: 1px solid #59657a;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .28);
    color: #f8f9fa;
    font-size: .88rem;
    max-width: min(22rem, calc(100vw - 2rem));
    padding: .55rem .7rem;
}

.app-map-attribution {
    background: rgba(248, 249, 250, .88);
    bottom: 0;
    color: #111827;
    font-size: .72rem;
    line-height: 1.2;
    padding: .15rem .35rem;
    position: absolute;
    right: 0;
    z-index: 3;
}

@keyframes app-map-pulse {
    0% {
        box-shadow: 0 0 0 2px rgba(255, 255, 255, .85), 0 0 0 0 rgba(240, 173, 78, .75);
    }

    70% {
        box-shadow: 0 0 0 2px rgba(255, 255, 255, .85), 0 0 0 .75rem rgba(240, 173, 78, 0);
    }

    100% {
        box-shadow: 0 0 0 2px rgba(255, 255, 255, .85), 0 0 0 0 rgba(240, 173, 78, 0);
    }
}

.app-map-missing-key {
    align-items: center;
    background: #202632;
    color: #f8f9fa;
    display: flex;
    flex-direction: column;
    inset: 0;
    justify-content: center;
    padding: 1.5rem;
    position: absolute;
    text-align: center;
    z-index: 2;
}

.app-map-missing-key p,
.app-map-device-meta {
    color: #aeb8ca;
}

.app-map-sidebar {
    background: #202632;
    border: 1px solid #303746;
    color: #f8f9fa;
    overflow: auto;
    padding: 1rem;
}

.app-map-device-list {
    display: grid;
    gap: .75rem;
}

.app-map-device-search {
    margin-bottom: .75rem;
}

.app-map-coordinate-form {
    background: #293140;
    border: 1px solid #394253;
    padding: .75rem;
}

.app-map-coordinate-form .form-control,
.app-map-coordinate-form .form-select {
    background-color: #202632;
    border-color: #59657a;
    color: #f8f9fa;
}

.app-map-coordinate-form .form-control::placeholder {
    color: #aeb8ca;
}

.app-map-device-empty {
    border: 1px solid #394253;
    color: #aeb8ca;
    padding: .9rem;
    text-align: center;
}

.app-map-device-group {
    border: 1px solid #394253;
    background: #232a37;
}

.app-map-device-group-toggle {
    align-items: center;
    background: #293140;
    border: 0;
    color: #f8f9fa;
    display: flex;
    gap: .55rem;
    padding: .65rem .75rem;
    text-align: left;
    width: 100%;
}

.app-map-device-group-toggle:focus,
.app-map-device-group-toggle:hover {
    background: #334055;
}

.app-map-device-group-icon {
    align-items: center;
    border: 1px solid #59657a;
    display: inline-flex;
    font-family: Consolas, "Liberation Mono", monospace;
    height: 1.35rem;
    justify-content: center;
    line-height: 1;
    width: 1.35rem;
}

.app-map-type-marker {
    border: 2px solid #111827;
    border-radius: 999px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .65);
    display: inline-block;
    flex: 0 0 auto;
    height: .85rem;
    width: .85rem;
}

.app-map-type-marker.type-gateway {
    background: #00a36c;
}

.app-map-type-marker.type-repeater {
    background: #f0ad4e;
}

.app-map-type-marker.type-torch {
    background: #d9534f;
}

.app-map-type-marker.type-chimera {
    background: #d97706;
}

.app-map-device-group-body {
    display: grid;
    gap: .75rem;
    padding: .75rem;
}

.app-map-device-group-body.single-type {
    padding: 0;
}

.app-map-device {
    background: #293140;
    border: 1px solid #394253;
    padding: .9rem;
}

.app-map-device.pending {
    border-color: #f0ad4e;
}

.app-map-device.lost {
    border-color: #6c757d;
    opacity: .86;
}

.app-map-device.warning {
    border-color: #ffc107;
}

.app-map-device-meta {
    font-size: .85rem;
}

.app-map-status {
    align-items: center;
    display: inline-flex;
    gap: .35rem;
    white-space: nowrap;
}

.app-map-popup {
    background: #ffffff;
    border: 1px solid #cfd6e3;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .35);
    color: #111827;
    max-height: min(32rem, calc(100dvh - 10rem));
    max-width: min(19rem, calc(100vw - 2rem));
    min-width: 14rem;
    overflow: auto;
    padding: .65rem;
}

.app-map-popup.pending {
    border-color: #f0ad4e;
}

.app-map-popup.lost {
    border-color: #6c757d;
}

.app-map-popup.warning {
    border-color: #ffc107;
}

.app-map-popup-result {
    align-items: center;
    display: inline-flex;
    font-size: .85rem;
    gap: .4rem;
    margin: 0 0 .5rem;
    padding: .3rem .45rem;
}

.app-map-popup-result.status-pending,
.app-map-popup-result.status-timeout {
    background: #fff3cd;
    border: 1px solid #f0ad4e;
    color: #7a4d00;
}

.app-map-popup-result.status-completed {
    background: #d1e7dd;
    border: 1px solid #75b798;
    color: #0f5132;
}

.app-map-popup-result.status-failed {
    background: #f8d7da;
    border: 1px solid #ea868f;
    color: #842029;
}

.app-map-popup-list {
    display: grid;
    gap: .25rem;
    margin: 0 0 .55rem;
}

.app-map-popup-list div {
    display: grid;
    gap: .5rem;
    grid-template-columns: 5.75rem minmax(0, 1fr);
}

.app-map-popup-list dt,
.app-map-popup-list dd {
    font-size: .86rem;
    line-height: 1.25;
}

.app-map-popup-list dt {
    color: #4b5563;
    font-weight: 700;
}

.app-map-popup-list dd {
    color: #111827;
    margin: 0;
}

.btn-primary {
    background: #4f79df;
    border-color: #4f79df;
    border-radius: 2px;
}

.btn-primary:focus,
.btn-primary:hover {
    background: #5d87ed;
    border-color: #5d87ed;
}

.btn-outline-light {
    border-color: #59657a;
    border-radius: 2px;
    color: #f8f9fa;
}

.btn-outline-light:focus,
.btn-outline-light:hover {
    background: #334055;
    border-color: #71829e;
    color: #ffffff;
}

.app-login-page {
    background:
        radial-gradient(circle at 50% 27%, rgba(227, 49, 55, .16), rgba(227, 49, 55, 0) 13rem),
        linear-gradient(180deg, #1e2430 0%, #151922 58%, #11151c 100%);
    color: #f8f9fa;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

.app-login-shell {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
    padding: clamp(1.5rem, 4vh, 3rem) clamp(1rem, 3vw, 3.5rem);
}

.app-login-card {
    background:
        linear-gradient(180deg, rgba(56, 65, 84, .62), rgba(31, 37, 50, .84)),
        rgba(24, 29, 40, .94);
    border: 1px solid rgba(120, 133, 160, .2);
    box-shadow: 0 2rem 5rem rgba(0, 0, 0, .35);
    margin-inline: auto;
    max-width: 27rem;
    padding: clamp(1.6rem, 4vw, 2.4rem);
}

.app-login-logo-mark {
    align-items: center;
    display: inline-flex;
    justify-content: center;
    margin-bottom: 1rem;
    position: relative;
}

.app-login-logo-mark::before {
    background: rgba(227, 49, 55, .14);
    border: 1px solid rgba(227, 49, 55, .26);
    border-radius: 50%;
    content: "";
    height: 5.3rem;
    left: 50%;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 5.3rem;
}

.app-login-subtitle {
    color: #b9c1d0;
    font-size: .98rem;
}

.app-login-form {
    margin-inline: auto;
    max-width: 23.5rem;
}

.app-login-control {
    background-color: #252b39;
    border: 1px solid #475165;
    border-radius: 0;
    color: #f8f9fa;
    min-height: 3.15rem;
}

.app-login-control:focus {
    background-color: #252b39;
    border-color: #e33137;
    box-shadow: 0 0 0 .16rem rgba(227, 49, 55, .22);
    color: #f8f9fa;
}

.form-floating > .app-login-control::placeholder {
    color: transparent;
}

.form-floating > .app-login-control:not(:placeholder-shown) ~ label,
.form-floating > .app-login-control:focus ~ label {
    color: #bfc7d8;
}

.form-floating > .app-login-control ~ label {
    color: #aeb6c6;
}

.form-floating > .app-login-control ~ label::after {
    background-color: transparent;
}

.app-login-submit {
    background: #4f79df;
    border-color: #4f79df;
    border-radius: 2px;
    font-weight: 700;
    min-height: 3rem;
}

.app-login-submit:focus,
.app-login-submit:hover {
    background: #5d87ed;
    border-color: #5d87ed;
}

@media (max-width: 991.98px) {
    .app-login-shell {
        justify-content: flex-start;
    }

    .app-map-grid {
        grid-template-columns: 1fr;
    }

    .app-map-sidebar {
        max-height: none;
    }
}

@media (max-width: 575.98px) {
    .app-login-page {
        min-height: 100dvh;
    }

    .app-login-shell {
        min-height: 100dvh;
        padding: 1rem;
    }

    .app-login-card {
        padding: 1.25rem;
    }

    .app-login-logo {
        height: 5.35rem;
        width: 5.35rem;
    }

    .app-brand-login {
        font-size: 1.75rem;
    }
}
