:root {
    --bg: #0e1013;
    --panel: #171a1f;
    --panel-2: #20252c;
    --text: #f4f0e8;
    --muted: #9ca3af;
    --line: rgba(255, 255, 255, 0.11);
    --accent: #f6c343;
    --accent-2: #48d6a3;
    --danger: #ff5f57;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

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

.shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    min-height: 100vh;
}

.map {
    min-height: 100vh;
}

.panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 100vh;
    padding: 20px;
    background: var(--panel);
    border-left: 1px solid var(--line);
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    color: #111;
    background: var(--accent);
    border-radius: 8px;
    font-weight: 900;
}

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

.brand p,
.pilot-card p,
.hint {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.panel-section {
    padding: 16px;
    background: linear-gradient(180deg, rgba(32, 37, 44, 0.98), rgba(24, 28, 34, 0.98));
    border: 1px solid var(--line);
    border-radius: 8px;
}

.pilot-card {
    padding: 0;
    overflow: hidden;
}

.pilot-profile {
    display: grid;
    grid-template-columns: 76px 1fr;
    gap: 14px;
    padding: 16px;
    background:
        linear-gradient(135deg, rgba(246, 195, 67, 0.16), transparent 46%),
        #1b2027;
}

.pilot-avatar {
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    overflow: hidden;
    color: #111;
    background: var(--accent);
    border: 2px solid rgba(246, 195, 67, 0.55);
    border-radius: 50%;
    font-size: 30px;
    font-weight: 900;
}

.pilot-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pilot-summary {
    align-self: center;
}

.pilot-summary strong {
    display: block;
    margin-top: 3px;
    font-size: 24px;
    line-height: 1.1;
}

.pilot-info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px 16px;
}

.pilot-info-grid div {
    padding: 10px;
    background: rgba(15, 18, 22, 0.72);
    border: 1px solid var(--line);
    border-radius: 7px;
}

.pilot-info-grid span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 5px;
}

.pilot-info-grid strong {
    display: block;
    color: var(--text);
    font-size: 13px;
    line-height: 1.35;
    white-space: pre-wrap;
}

.profile-editor {
    padding: 0 16px 14px;
}

.profile-editor summary {
    display: inline-flex;
    cursor: pointer;
    color: var(--accent);
    font-size: 13px;
    font-weight: 800;
    list-style: none;
}

.profile-editor summary::-webkit-details-marker {
    display: none;
}

.profile-editor form {
    margin-top: 12px;
}

.pilot-card > .ghost-button {
    width: calc(100% - 32px);
    margin: 0 16px 16px;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.eyebrow {
    display: block;
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.stack {
    display: grid;
    gap: 12px;
}

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

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    color: var(--text);
    background: #0f1216;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 10px;
}

textarea {
    resize: vertical;
}

.primary-button,
.ghost-button,
.icon-button,
.tab {
    border: 0;
    border-radius: 7px;
    cursor: pointer;
    font-weight: 800;
}

.primary-button {
    color: #151515;
    background: var(--accent);
    padding: 11px 12px;
}

.ghost-button {
    width: 100%;
    margin-top: 12px;
    color: var(--text);
    background: transparent;
    border: 1px solid var(--line);
    padding: 10px;
}

.ghost-button.compact {
    width: auto;
    margin-top: 0;
    padding: 7px 10px;
    font-size: 12px;
}

.icon-button {
    width: 34px;
    height: 34px;
    color: #111;
    background: var(--accent-2);
    font-size: 20px;
}

.icon-button.muted {
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
}

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

.tab {
    padding: 10px;
    color: var(--text);
    background: #11151a;
    border: 1px solid var(--line);
}

.tab.active {
    color: #111;
    background: var(--accent);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: grid;
}

.hidden-field {
    position: absolute;
    left: -9999px;
}

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

.filter-list label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.item-list {
    display: grid;
    gap: 10px;
}

.item-row {
    display: grid;
    gap: 8px;
    padding: 10px;
    background: #11151a;
    border: 1px solid var(--line);
    border-radius: 7px;
}

.item-row-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.item-row strong {
    color: var(--text);
    font-size: 14px;
}

.item-meta {
    color: var(--muted);
    font-size: 12px;
}

.member-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 8px;
}

.member-details {
    margin-top: 8px;
}

.member-details summary {
    cursor: pointer;
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
}

.pilot-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 5px 8px 5px 5px;
    cursor: pointer;
    font-size: 12px;
}

.mini-avatar {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    overflow: hidden;
    color: #111;
    background: var(--accent);
    border-radius: 50%;
    font-size: 11px;
    font-weight: 900;
}

.mini-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.online-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--accent-2);
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(72, 214, 163, 0.16);
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.small-button,
.danger-button {
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    padding: 7px 9px;
    font-size: 12px;
    font-weight: 800;
}

.small-button {
    color: #111;
    background: var(--accent-2);
}

.danger-button {
    color: #fff;
    background: var(--danger);
}

.admin-panel h2 {
    margin: 16px 0 10px;
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
}

.admin-grid {
    display: grid;
    gap: 8px;
}

.join-form {
    margin: 14px 0;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.group-invites {
    display: grid;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
}

.inline-mini-form {
    display: grid;
    grid-template-columns: 1fr 86px auto;
    gap: 6px;
    margin-top: 8px;
}

.compact-list .item-row {
    gap: 4px;
}

.toast {
    position: sticky;
    bottom: 0;
    margin: auto 0 0;
    padding: 12px;
    color: #111;
    background: var(--accent);
    border-radius: 8px;
    font-weight: 700;
}

.toast.error {
    color: #fff;
    background: var(--danger);
}

.leaflet-popup-content-wrapper {
    color: var(--text);
    background: #15181d;
    border: 1px solid rgba(246, 195, 67, 0.35);
    border-radius: 8px;
}

.leaflet-popup-tip {
    background: #15181d;
}

.leaflet-control-layers {
    color: var(--text);
    background: rgba(21, 24, 29, 0.92) !important;
    border: 1px solid rgba(246, 195, 67, 0.35) !important;
    border-radius: 8px !important;
}

.leaflet-control-layers-expanded {
    padding: 10px 12px !important;
}

.spot-marker {
    background: transparent;
    border: 0;
}

.spot-pin {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    background: rgba(14, 16, 19, 0.86);
    border: 1px solid rgba(246, 195, 67, 0.75);
    border-radius: 50%;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    font-size: 17px;
}

.spot-pin svg {
    width: 18px;
    height: 18px;
    stroke: var(--accent);
}

.popup-photo {
    width: 260px;
    height: 135px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 10px;
}

.popup-title {
    margin: 0 0 6px;
    color: var(--accent);
    font-size: 16px;
}

.popup-meta {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 8px;
}

.popup-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    margin: 4px 0 8px;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.status-open {
    color: #0f2019;
    background: var(--accent-2);
}

.status-caution {
    color: #201600;
    background: #f6c343;
}

.status-closed {
    color: #fff;
    background: var(--danger);
}

.status-unknown {
    color: var(--text);
    background: rgba(255, 255, 255, 0.1);
}

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

.comment-form,
.event-form {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.comment-form textarea,
.event-form textarea {
    min-height: 64px;
}

.popup-actions a,
.popup-actions button {
    flex: 1;
    border: 0;
    border-radius: 6px;
    padding: 8px;
    text-align: center;
    text-decoration: none;
    color: #111;
    background: var(--accent);
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
}

.modal {
    width: min(520px, calc(100vw - 24px));
    padding: 0;
    color: var(--text);
    background: transparent;
    border: 0;
}

.modal::backdrop {
    background: rgba(0, 0, 0, 0.72);
}

.modal-card {
    padding: 18px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.5);
}

.pilot-detail-card {
    display: grid;
    gap: 14px;
}

.pilot-detail-head {
    display: grid;
    grid-template-columns: 68px 1fr;
    gap: 14px;
    align-items: center;
}

.pilot-detail-avatar {
    display: grid;
    place-items: center;
    width: 68px;
    height: 68px;
    overflow: hidden;
    color: #111;
    background: var(--accent);
    border-radius: 50%;
    font-size: 28px;
    font-weight: 900;
}

.pilot-detail-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pilot-detail-grid {
    display: grid;
    gap: 8px;
}

.pilot-detail-grid div {
    padding: 10px;
    background: #11151a;
    border: 1px solid var(--line);
    border-radius: 7px;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.check-row input {
    width: auto;
}

@media (max-width: 860px) {
    .shell {
        grid-template-columns: 1fr;
    }

    .map {
        min-height: 58vh;
    }

    .panel {
        min-height: auto;
        border-left: 0;
        border-top: 1px solid var(--line);
    }

    .inline-mini-form {
        grid-template-columns: 1fr;
    }
}
