* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: Arial, Helvetica, sans-serif;
    background: #0f172a;
    color: #e5e7eb;
}

a {
    color: #93c5fd;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

button {
    border: 0;
    border-radius: 12px;
    padding: 11px 14px;
    background: #22c55e;
    color: #052e16;
    font-weight: 700;
    cursor: pointer;
}

button:hover {
    filter: brightness(1.05);
}

input {
    width: 100%;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 12px;
    background: #020617;
    color: #f8fafc;
}

label {
    display: block;
    margin: 12px 0 6px;
    color: #cbd5e1;
    font-size: 14px;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background:
        radial-gradient(circle at top left, rgba(34, 197, 94, .25), transparent 35%),
        radial-gradient(circle at bottom right, rgba(59, 130, 246, .25), transparent 35%),
        #020617;
}

.auth-card {
    width: min(420px, 100%);
    padding: 26px;
    background: rgba(15, 23, 42, .92);
    border: 1px solid rgba(148, 163, 184, .25);
    border-radius: 24px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .45);
}

.auth-card h1 {
    margin: 0 0 6px;
    font-size: 30px;
}

.auth-card p {
    margin-top: 0;
    color: #94a3b8;
}

.auth-card button {
    width: 100%;
    margin: 16px 0;
}

.alert {
    border-radius: 14px;
    padding: 12px;
    margin: 14px 0;
}

.alert.error {
    background: rgba(239, 68, 68, .15);
    border: 1px solid rgba(239, 68, 68, .4);
    color: #fecaca;
}

.map-page {
    overflow: hidden;
}

.topbar {
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(2, 6, 23, .96);
    border-bottom: 1px solid rgba(148, 163, 184, .2);
}

.topbar strong {
    display: block;
    font-size: 18px;
}

.topbar span {
    color: #94a3b8;
    font-size: 13px;
}

.topbar nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar nav button,
.topbar nav a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 9px 12px;
    border-radius: 11px;
    background: #1e293b;
    color: #e5e7eb;
    font-weight: 700;
}

.layout {
    height: calc(100vh - 62px);
    display: grid;
    grid-template-columns: 1fr 380px;
}

.map-wrap {
    position: relative;
    min-width: 0;
}

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

.sidebar {
    overflow: auto;
    padding: 14px;
    background: #020617;
    border-left: 1px solid rgba(148, 163, 184, .18);
}

.card {
    background: rgba(15, 23, 42, .96);
    border: 1px solid rgba(148, 163, 184, .18);
    border-radius: 18px;
    padding: 14px;
    margin-bottom: 14px;
}

.card h2 {
    margin: 0 0 12px;
    font-size: 18px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}

.list {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.list-item {
    padding: 10px;
    border-radius: 14px;
    background: #0f172a;
    border: 1px solid rgba(148, 163, 184, .15);
}

.list-item strong {
    display: block;
}

.list-item small {
    display: block;
    color: #94a3b8;
    margin-top: 4px;
}

.floating-panel {
    position: absolute;
    left: 14px;
    bottom: 14px;
    z-index: 500;
    width: min(360px, calc(100% - 28px));
    padding: 12px;
    border-radius: 18px;
    background: rgba(2, 6, 23, .88);
    border: 1px solid rgba(148, 163, 184, .24);
    backdrop-filter: blur(10px);
    line-height: 1.55;
}

.chat-box {
    height: 220px;
    overflow: auto;
    padding: 10px;
    border-radius: 14px;
    background: #020617;
    border: 1px solid rgba(148, 163, 184, .18);
}

.chat-msg {
    padding: 8px 0;
    border-bottom: 1px solid rgba(148, 163, 184, .12);
}

.chat-msg strong {
    color: #86efac;
}

.chat-msg small {
    display: block;
    color: #94a3b8;
    margin-top: 3px;
}

#chatForm {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    margin-top: 10px;
}

.leaflet-popup-content {
    color: #111827;
}

@media (max-width: 980px) {
    .layout {
        grid-template-columns: 1fr;
        grid-template-rows: 58vh 1fr;
        overflow: auto;
    }

    .map-wrap {
        min-height: 58vh;
    }

    .sidebar {
        border-left: 0;
        border-top: 1px solid rgba(148, 163, 184, .18);
    }

    .map-page {
        overflow: auto;
    }
}

@media (max-width: 620px) {
    .topbar {
        height: auto;
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar nav {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
    }

    .topbar nav button,
    .topbar nav a {
        justify-content: center;
        padding: 10px 8px;
        font-size: 13px;
    }

    .layout {
        height: auto;
        min-height: calc(100vh - 104px);
        grid-template-rows: 60vh auto;
    }

    .floating-panel {
        font-size: 13px;
    }

    #chatForm {
        grid-template-columns: 1fr;
    }
}

.leaflet-tooltip.user-name-label {
    background: rgba(15, 23, 42, .92);
    color: #f8fafc;
    border: 1px solid rgba(34, 197, 94, .65);
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(0, 0, 0, .35);
}

.leaflet-tooltip.current-user-label {
    border-color: rgba(59, 130, 246, .85);
}

.gps-marker {
    position: relative;
    width: 46px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gps-arrow {
    width: 0;
    height: 0;
    border-left: 13px solid transparent;
    border-right: 13px solid transparent;
    border-bottom: 34px solid #22c55e;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .45));
    transform-origin: 50% 60%;
}

.gps-marker-current .gps-arrow {
    border-bottom-color: #3b82f6;
}

.gps-marker-name {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    background: rgba(15, 23, 42, .94);
    color: #f8fafc;
    border: 1px solid rgba(34, 197, 94, .7);
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(0, 0, 0, .35);
}

.gps-marker-current .gps-marker-name {
    border-color: rgba(59, 130, 246, .9);
}

.leaflet-div-icon {
    background: transparent;
    border: 0;
}
