:root {
    color-scheme: light;
    --bg: #eef2f6;
    --panel: #ffffff;
    --panel-soft: #f8fafc;
    --text: #111827;
    --muted: #667085;
    --line: #d7dee8;
    --accent: #0f766e;
    --accent-strong: #134e4a;
    --accent-soft: #d9f4ef;
    --alert: #dc2626;
    --warn: #b7791f;
    --ok: #15803d;
    --shadow: 0 16px 42px rgba(15, 23, 42, 0.12);
    font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
}

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

button {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    transition: background-color 140ms ease, border-color 140ms ease, transform 140ms ease;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.48;
    filter: grayscale(0.25);
}

button:hover,
button:focus-visible {
    background: #f8fafc;
    border-color: #9fb0c2;
}

button:active,
button:active {
    transform: translateY(1px);
}

button.primary,
.status-grid button {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    font-weight: 700;
}

svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.app-shell {
    height: 100vh;
    height: 100dvh;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
}

.topbar {
    min-height: 68px;
    padding: 12px 16px;
    background: linear-gradient(90deg, #12372a, #155e57);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: relative;
    z-index: 10;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.22);
}

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

.header-actions button {
    padding: 0 12px;
}

.session-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.session-actions a,
.button-link {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    text-decoration: none;
    font-weight: 700;
}

.brand-block {
    min-width: 180px;
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 10px;
    align-items: center;
}

.brand-logo {
    width: 46px;
    height: 46px;
    grid-row: span 2;
    object-fit: contain;
    border-radius: 50%;
    background: #ffffff;
}

.brand {
    display: block;
    font-size: 23px;
    line-height: 1;
}

.subtitle {
    display: block;
    color: #cce8e2;
    font-size: 13px;
    margin-top: 5px;
}

.auth-logo {
    width: 82px;
    height: 82px;
    justify-self: center;
    grid-column: 1 / -1;
    margin-bottom: 2px;
}

.vehicle-command {
    display: none;
    min-height: 72px;
    padding: 10px 14px;
    gap: 12px;
    align-items: center;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
    position: relative;
    z-index: 9;
}

body[data-mode="vehicle"] .vehicle-command {
    display: flex;
}

.vehicle-picker {
    width: min(280px, 34vw);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.vehicle-picker strong {
    color: var(--text);
    font-size: 15px;
    text-transform: none;
}

.ghost-button {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    padding: 0 12px;
}

body:not([data-mode="vehicle"]) [data-mode-only="vehicle"],
body:not([data-mode="ops"]) [data-mode-only="ops"],
body:not([data-mode="mobile"]) [data-mode-only="mobile"] {
    display: none !important;
}

body[data-mode="mobile"] [data-layer-row="interventions"],
body[data-mode="mobile"] [data-layer-row="vehicles"] {
    display: none !important;
}

.workspace {
    min-height: 0;
    height: 100%;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-columns: 1fr;
    position: relative;
    z-index: 1;
}

.workspace > section {
    margin-top: 0;
}

body:not([data-mode="ops"]) .workspace {
    grid-template-rows: minmax(0, 1fr);
}

.ops-tabs {
    display: flex;
    gap: 6px;
    padding: 10px;
    overflow-x: auto;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
}

.tab-button {
    padding: 0 14px;
    white-space: nowrap;
}

.tab-button.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    font-weight: 800;
}

.panel {
    min-height: 0;
    overflow: auto;
    background: rgba(255, 255, 255, 0.97);
    border-right: 1px solid var(--line);
    padding: 16px;
    position: relative;
    z-index: 3;
}

.panel-right {
    border-right: 0;
    border-left: 1px solid var(--line);
}

.section-heading {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 12px;
}

.section-heading.small {
    margin-bottom: 8px;
}

.section-heading svg {
    color: var(--accent);
}

h1,
h2 {
    margin: 0;
}

h1 {
    font-size: 21px;
}

h2 {
    font-size: 16px;
}

section + section {
    margin-top: 20px;
}

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

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 11px;
    color: var(--text);
    background: #ffffff;
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea {
    resize: vertical;
}

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

.coord-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.status-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    gap: 8px;
}

.status-grid button {
    min-height: 50px;
    text-transform: uppercase;
    font-size: 13px;
}

.info-button {
    min-width: 92px;
    min-height: 50px;
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #ffffff;
    font-weight: 800;
}

.map-wrap {
    min-width: 0;
    min-height: 360px;
    height: 100%;
    position: relative;
    z-index: 1;
    overflow: hidden;
    background: #dbe4ea;
    overscroll-behavior: contain;
    touch-action: none;
}

body[data-mode="ops"] .map-wrap {
    min-height: 360px;
}

.map-wrap.is-loading #map {
    opacity: 0.35;
}

#map {
    width: 100%;
    height: 100%;
    min-height: 360px;
    position: relative;
    z-index: 0;
    transition: opacity 180ms ease;
    touch-action: none;
}

.map-loader {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(238, 242, 246, 0.82);
    color: var(--accent-strong);
    font-weight: 800;
    pointer-events: none;
    user-select: none;
}

.map-wrap.is-loading .map-loader {
    display: flex;
}

.map-controls {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 4;
    width: min(260px, calc(100% - 24px));
    display: grid;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow);
}

.map-controls-head,
.map-controls-panel {
    display: grid;
    gap: 8px;
}

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

.map-tool-button {
    min-height: 36px;
    padding: 0 9px;
    font-size: 13px;
    font-weight: 800;
}

.map-tool-button.is-active {
    border-color: var(--accent);
    color: #ffffff;
    background: var(--accent);
}

.map-controls.is-collapsed {
    width: min(260px, calc(100% - 24px));
}

.map-controls.is-collapsed .map-controls-panel {
    display: none;
}

.map-controls.is-collapsed #toggle-map-controls {
    border-color: var(--accent);
    color: var(--accent-strong);
    background: var(--accent-soft);
}

body[data-mode="ops"] #follow-position {
    display: none;
}

.map-popup {
    min-width: 240px;
    max-width: 320px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #ffffff;
    box-shadow: var(--shadow);
    position: relative;
}

.map-popup:empty {
    display: none;
}

.place-info-dialog {
    box-sizing: border-box;
}

.map-popup.is-place-info {
    width: min(760px, calc(100vw - 36px));
    max-width: min(760px, calc(100vw - 36px));
    max-height: min(72vh, 680px);
    overflow: auto;
    padding: 14px;
}

.popup-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    z-index: 2;
}

.popup-header {
    padding-right: 40px;
}

.popup-title {
    font-weight: 800;
    margin-bottom: 4px;
}

.popup-meta {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
}

.popup-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.popup-actions button {
    min-height: 34px;
    padding: 0 10px;
}

.place-popup-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(250px, 1fr));
    gap: 12px;
    align-items: start;
    margin-top: 10px;
}

.place-summary {
    display: grid;
    gap: 8px;
    grid-column: 1 / -1;
}

.data-panel {
    min-height: 0;
    overflow: auto;
    padding: 14px;
    background: var(--bg);
}

.grid-toolbar {
    margin-bottom: 10px;
}

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

.grid-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    align-items: center;
    min-height: 54px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.grid-row.header {
    min-height: 38px;
    background: #e8eef4;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.grid-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.grid-actions button {
    min-height: 34px;
    padding: 0 9px;
}

.grid-actions [data-grid-action="cancel-event"] {
    color: var(--alert);
    border-color: #fecaca;
    background: #fff7f7;
}

.grid-loading,
.grid-empty {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--muted);
}

.grid-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
    color: var(--muted);
}

.pager-actions {
    display: flex;
    gap: 6px;
}

.pager-actions button {
    width: 38px;
    min-height: 34px;
    padding: 0;
}

.detail-map {
    width: 100%;
    height: min(58vh, 430px);
    min-height: 300px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #dbe4ea;
}

.track-map-wrap {
    position: relative;
}

.track-popup {
    position: absolute;
}

.map-controls label {
    font-size: 12px;
}

.map-search {
    display: grid;
    grid-template-columns: 1fr 40px;
    gap: 6px;
}

.map-search input {
    min-height: 40px;
}

.map-search button {
    width: 40px;
    padding: 0;
}

.layer-toggles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 10px;
}

.layer-toggles label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text);
    font-weight: 700;
}

.layer-toggles input {
    width: auto;
}

.list {
    display: grid;
    gap: 9px;
}

.item {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 11px;
    background: var(--panel-soft);
}

.item-title {
    font-weight: 800;
    margin-bottom: 4px;
}

.item-meta {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
}

.item-actions {
    display: flex;
    gap: 6px;
    margin-top: 9px;
}

.item-actions button {
    min-height: 34px;
    padding: 0 10px;
}

.badge {
    display: inline-block;
    margin-left: 6px;
    padding: 3px 7px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 11px;
    font-weight: 800;
}

.badge.alert {
    background: #fee2e2;
    color: var(--alert);
}

.badge.pending,
.verify-badge {
    background: rgba(217, 119, 6, 0.12);
    color: #92400e;
    border: 1px solid rgba(217, 119, 6, 0.22);
}

.popup-details {
    display: grid;
    gap: 6px;
    margin-top: 10px;
    font-size: 13px;
}

.popup-details div {
    display: grid;
    gap: 2px;
}

.popup-details strong {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
}

.nearby-section {
    display: grid;
    gap: 7px;
    margin-top: 10px;
}

.nearby-section > strong {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--muted);
}

.nearby-list {
    display: grid;
    gap: 6px;
    max-height: 210px;
    overflow: auto;
}

.nearby-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 34px;
    gap: 8px;
    align-items: center;
    padding: 7px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.78);
}

.nearby-item span,
.nearby-item small {
    display: block;
    min-width: 0;
    overflow-wrap: anywhere;
}

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

.nearby-item button,
.nearby-more {
    min-height: 34px;
}

.compact {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
}

.inline-actions {
    margin-bottom: 9px;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    background: #101828;
    color: #ffffff;
    padding: 10px 14px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    z-index: 1000;
}

.modal {
    width: min(520px, calc(100vw - 28px));
    border: 0;
    border-radius: 12px;
    padding: 0;
    box-shadow: var(--shadow);
}

.wide-modal {
    width: min(760px, calc(100vw - 28px));
}

.modal.is-dragged,
.assignment-alert.is-dragged {
    margin: 0;
    position: fixed;
}

.modal::backdrop {
    background: rgba(15, 23, 42, 0.42);
}

.modal-card {
    padding: 16px;
    background: #ffffff;
}

.modal-head,
.modal-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.modal-head {
    cursor: move;
    user-select: none;
}

.modal-actions {
    justify-content: flex-end;
}

.icon-button {
    width: 40px;
    padding: 0;
}

.geocode-results {
    display: grid;
    gap: 6px;
}

.geocode-result {
    min-height: auto;
    justify-content: flex-start;
    padding: 8px 10px;
    text-align: left;
    line-height: 1.25;
}

.assignment-alert {
    width: min(640px, calc(100vw - 24px));
    border: 0;
    border-radius: 14px;
    padding: 0;
    box-shadow: var(--shadow);
}

.assignment-alert::backdrop {
    background: rgba(127, 29, 29, 0.58);
}

.assignment-card {
    display: grid;
    gap: 18px;
    padding: 22px;
    background: #ffffff;
    border-top: 8px solid var(--alert);
}

.assignment-card h2 {
    font-size: 24px;
}

.assignment-card p {
    margin: 0;
    font-size: 18px;
    line-height: 1.35;
}

.assignment-card button {
    min-height: 54px;
    font-size: 18px;
}

.info-panel {
    display: grid;
    gap: 12px;
}

.info-section {
    display: grid;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
}

.info-section h3 {
    margin: 0;
    font-size: 15px;
}

.info-line {
    color: var(--muted);
    line-height: 1.35;
}

.nearest-row,
.status-log-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 8px;
    border-radius: 8px;
    background: #ffffff;
}

.nearest-row span,
.nearest-row small,
.status-log-row span,
.status-log-row small {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

[hidden] {
    display: none !important;
}

@media (max-width: 1100px) {
    body {
        overflow: auto;
    }

    .app-shell {
        min-height: 100vh;
        height: auto;
        grid-template-rows: auto auto auto;
    }

    body[data-mode="ops"] .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    body[data-mode="mobile"] .topbar,
    body[data-mode="vehicle"] .topbar {
        min-height: 54px;
        padding: 7px 9px;
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }

    body[data-mode="mobile"] .brand-block,
    body[data-mode="vehicle"] .brand-block {
        min-width: 0;
        flex: 1 1 auto;
        grid-template-columns: auto minmax(0, 1fr);
        column-gap: 8px;
    }

    body[data-mode="mobile"] .brand-logo,
    body[data-mode="vehicle"] .brand-logo {
        width: 36px;
        height: 36px;
    }

    body[data-mode="mobile"] .brand,
    body[data-mode="vehicle"] .brand {
        font-size: 15px;
        white-space: nowrap;
    }

    body[data-mode="mobile"] .subtitle,
    body[data-mode="vehicle"] .subtitle {
        max-width: 48vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 11px;
    }

    body[data-mode="mobile"] .session-actions,
    body[data-mode="vehicle"] .session-actions {
        flex: 0 0 auto;
        gap: 6px;
    }

    body[data-mode="mobile"] .session-actions a,
    body[data-mode="vehicle"] .session-actions a {
        display: none;
    }

    body[data-mode="mobile"] .session-actions button,
    body[data-mode="vehicle"] .session-actions button,
    body[data-mode="vehicle"] #change-vehicle {
        min-height: 36px;
        padding: 0 9px;
        font-size: 12px;
    }

    body[data-mode="mobile"] .session-actions button span,
    body[data-mode="vehicle"] .session-actions button span,
    body[data-mode="vehicle"] #change-vehicle span {
        display: none;
    }

    .mode-tabs,
    .vehicle-command {
        width: 100%;
    }

    body[data-mode="vehicle"] .vehicle-command {
        align-items: stretch;
        flex-direction: column;
    }

    .vehicle-picker {
        width: 100%;
    }

    .status-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .status-grid button:last-child {
        grid-column: 1 / -1;
    }

    .workspace {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(560px, 70vh);
    }

    body[data-mode="ops"] {
        overflow: hidden;
    }

    body[data-mode="ops"] .app-shell {
        height: 100vh;
        height: 100dvh;
        min-height: 0;
        grid-template-rows: auto minmax(0, 1fr);
    }

    body[data-mode="ops"] .workspace {
        min-height: 0;
        height: 100%;
        grid-template-rows: auto minmax(0, 1fr);
    }

    body[data-mode="ops"] .map-wrap,
    body[data-mode="ops"] #map {
        min-height: 0;
        height: 100%;
    }

    .panel,
    .panel-right {
        border: 0;
        border-bottom: 1px solid var(--line);
    }
}

body[data-mode="mobile"] {
    overflow: hidden;
}

body[data-mode="mobile"] .app-shell {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr);
}

body[data-mode="mobile"] .workspace {
    min-height: 0;
    height: 100%;
    grid-template-rows: minmax(0, 1fr);
}

body[data-mode="mobile"] .map-wrap,
body[data-mode="mobile"] #map {
    min-height: 0;
    height: 100%;
}

@media (max-width: 700px) {
    .place-info-dialog.is-mobile-sheet {
        width: 100vw;
        max-width: none;
        height: 100dvh;
        max-height: none;
        margin: 0;
        border-radius: 0;
        border: 0;
        padding: 16px;
        overflow: auto;
    }

    .place-info-dialog.is-mobile-sheet::backdrop {
        background: rgba(15, 23, 42, 0.38);
    }

    .place-info-dialog.is-mobile-sheet .popup-close {
        position: fixed;
        top: 12px;
        right: 12px;
    }

    .place-popup-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .nearby-list {
        max-height: none;
    }

    body[data-mode="mobile"] .map-controls,
    body[data-mode="vehicle"] .map-controls {
        top: 8px;
        left: 8px;
        width: min(244px, calc(100% - 16px));
        padding: 8px;
        gap: 7px;
    }

    body[data-mode="mobile"] .map-controls-head,
    body[data-mode="vehicle"] .map-controls-head {
        grid-template-columns: 1fr auto;
    }

    body[data-mode="mobile"] .map-tool-button,
    body[data-mode="vehicle"] .map-tool-button {
        min-height: 34px;
        padding: 0 8px;
    }

    body[data-mode="mobile"] .map-tool-button span,
    body[data-mode="vehicle"] .map-tool-button span {
        font-size: 12px;
    }

    body[data-mode="mobile"] .map-search,
    body[data-mode="vehicle"] .map-search {
        grid-template-columns: minmax(0, 1fr) 36px;
    }

    body[data-mode="mobile"] .map-search input,
    body[data-mode="vehicle"] .map-search input {
        min-height: 36px;
        font-size: 13px;
    }

    body[data-mode="mobile"] .map-search button,
    body[data-mode="vehicle"] .map-search button {
        width: 36px;
        min-height: 36px;
    }
}

.auth-body,
.admin-body {
    min-height: 100vh;
    height: auto;
    overflow: auto;
}

.auth-body {
    display: grid;
    place-items: center;
    padding: 20px;
    background: #e8eef4;
}

.auth-card {
    width: min(420px, 100%);
    display: grid;
    gap: 16px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: var(--shadow);
}

.auth-card .brand {
    color: var(--accent-strong);
}

.auth-card .subtitle {
    color: var(--muted);
}

.auth-error,
.auth-ok {
    padding: 10px 12px;
    border-radius: 8px;
    font-weight: 700;
}

.auth-error {
    background: #fee2e2;
    color: var(--alert);
}

.auth-ok {
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.auth-link {
    color: var(--accent-strong);
    font-weight: 800;
    text-align: center;
    text-decoration: none;
}

.auth-link:hover {
    text-decoration: underline;
}

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

.check-row input {
    width: auto;
}

.admin-page {
    width: min(1180px, calc(100% - 24px));
    display: grid;
    gap: 16px;
    margin: 18px auto 34px;
}

.admin-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 16px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(15, 118, 110, 0.13), rgba(255, 255, 255, 0) 52%),
        #ffffff;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

.admin-hero h1 {
    margin: 2px 0 6px;
    font-size: clamp(26px, 3vw, 38px);
    line-height: 1.05;
}

.admin-hero p {
    max-width: 680px;
    margin: 0;
    color: var(--muted);
}

.eyebrow {
    margin: 0;
    color: var(--accent-strong);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.admin-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.admin-stats span {
    min-width: 118px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
    color: var(--muted);
    text-align: right;
}

.admin-stats strong {
    display: block;
    color: var(--text);
    font-size: 22px;
    line-height: 1;
}

.admin-section {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.admin-section h2 {
    margin: 0;
    font-size: 20px;
}

.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.admin-user-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    align-items: end;
}

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

.user-card {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
}

.user-edit-form {
    display: grid;
    gap: 10px;
}

.user-card-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.user-card-head strong,
.user-card-head span {
    display: block;
}

.user-card-head span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 13px;
}

.user-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.user-card-grid {
    display: grid;
    grid-template-columns: minmax(160px, 1.1fr) minmax(220px, 1.4fr) minmax(150px, 0.8fr) minmax(150px, 0.9fr) minmax(120px, 0.6fr);
    gap: 10px;
    align-items: end;
}

.user-actions {
    display: flex;
    justify-content: flex-end;
}

.delete-user-form {
    display: flex;
    justify-content: flex-end;
    margin: -2px 0 0;
}

.delete-user-form button {
    min-height: 32px;
    color: var(--alert);
    border-color: #fecaca;
    background: #fff7f7;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.pagination a,
.pagination span {
    min-width: 34px;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--text);
    text-decoration: none;
}

.pagination .active span {
    border-color: var(--accent);
    background: var(--accent);
    color: #ffffff;
}

@media (max-width: 560px) {
    .topbar {
        padding: 10px;
    }

    .status-grid span {
        font-size: 12px;
    }

    .status-grid {
        grid-template-columns: 1fr;
    }

    .status-grid button:last-child {
        grid-column: auto;
    }

    .coord-grid {
        grid-template-columns: 1fr;
    }

    .header-actions {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }

    .header-actions button span {
        display: none;
    }

    .grid-row,
    .grid-row.header {
        grid-template-columns: 1fr;
    }

    .grid-row.header {
        display: none;
    }

    .admin-hero,
    .section-title-row,
    .user-card-head {
        grid-template-columns: 1fr;
        display: grid;
    }

    .admin-stats,
    .user-badges,
    .user-actions,
    .delete-user-form {
        justify-content: stretch;
    }

    .admin-stats span,
    .user-actions button,
    .delete-user-form button {
        width: 100%;
    }

    .user-card-grid {
        grid-template-columns: 1fr;
    }
}
