:root {
    color-scheme: light;
    --bg: #f8faf7;
    --panel: #ffffff;
    --ink: #17201a;
    --muted: #647067;
    --line: #d8dfd8;
    --accent: #116149;
    --accent-dark: #0b4635;
    --danger: #a6422a;
    --warning: #b7791f;
    --ok: #127a4b;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.map-panel {
    position: relative;
    min-height: 100vh;
}

#map {
    width: 100%;
    height: 100%;
    min-height: 100vh;
}

.status-bar {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid rgba(23, 32, 26, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    font-size: 14px;
    font-weight: 650;
}

.gps-pill {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    border-radius: 999px;
    padding: 6px 10px;
    background: #e9eee9;
    color: var(--ink);
    font-weight: 850;
}

.gps-pill::before {
    content: "";
    width: 9px;
    height: 9px;
    margin-right: 7px;
    border-radius: 50%;
    background: #7b857d;
}

.gps-pill[data-state="starting"]::before {
    background: var(--warning);
}

.gps-pill[data-state="on"] {
    background: #e3f5ec;
    color: #0d4f31;
}

.gps-pill[data-state="on"]::before {
    background: var(--ok);
}

.gps-pill[data-state="blocked"] {
    background: #f8e7e1;
    color: #722f1e;
}

.gps-pill[data-state="blocked"]::before {
    background: var(--danger);
}

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

.top-row,
.button-row,
.feature-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.top-row {
    justify-content: space-between;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: 22px;
    line-height: 1.15;
}

h2 {
    font-size: 16px;
}

.gps-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.gps-detail {
    display: grid;
    gap: 3px;
    min-height: 58px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfb;
}

.gps-detail span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.gps-detail strong {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 14px;
}

form,
label {
    display: grid;
    gap: 8px;
}

form {
    gap: 12px;
}

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

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 10px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

textarea {
    resize: vertical;
}

button,
.export-link {
    min-height: 42px;
    border: 0;
    border-radius: 8px;
    padding: 10px 13px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-weight: 750;
    text-decoration: none;
}

button:hover,
.export-link:hover {
    background: var(--accent-dark);
}

button:disabled {
    background: #a9b5ad;
}

button.secondary {
    background: #e9eee9;
    color: var(--ink);
}

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

.button-row button {
    flex: 1;
}

.form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 96px;
    gap: 10px;
}

.muted {
    color: var(--muted);
    font-size: 13px;
}

.feature-list {
    display: grid;
    gap: 8px;
}

.feature-item {
    display: grid;
    gap: 6px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfb;
}

.feature-title {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-weight: 800;
}

.feature-meta {
    color: var(--muted);
    font-size: 13px;
}

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

    .map-panel,
    #map {
        min-height: 54vh;
    }

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

    .gps-details {
        grid-template-columns: 1fr;
    }
}
