* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a2e;
    color: #e0e0e0;
}

.app {
    display: flex;
    height: 100vh;
    width: 100vw;
}

.sidebar {
    width: 280px;
    min-width: 280px;
    background: #16213e;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
    z-index: 1000;
}

.sidebar h1 {
    color: #ffffff;
    font-size: 20px;
    font-weight: 700;
    text-align: center;
}

.subtitle {
    color: #555;
    font-size: 11px;
    text-align: center;
    margin-top: -8px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.control-group label {
    font-weight: 500;
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.control-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    background: #0f3460;
    color: #fff;
    font-size: 13px;
    outline: none;
    cursor: pointer;
}

.control-group select:focus {
    border-color: #4CAF50;
}

input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: #2a2a4a;
    border-radius: 3px;
    outline: none;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #4CAF50;
    border-radius: 50%;
    cursor: pointer;
}

#heightValue, #exaggerationValue {
    color: #4CAF50;
    font-weight: 600;
    font-size: 13px;
}

.checkbox-label {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    text-transform: none !important;
    letter-spacing: normal !important;
    color: #ccc !important;
    font-size: 13px !important;
}

.checkbox-label input[type=checkbox] {
    width: 16px;
    height: 16px;
    accent-color: #4CAF50;
    cursor: pointer;
}

#generateBtn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #4CAF50, #2e7d32);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 160ms ease-out, background-color 200ms ease, box-shadow 200ms ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#generateBtn:hover:not(:disabled) {
    background: linear-gradient(135deg, #5cbf60, #388e3c);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

#generateBtn:disabled {
    background: #2a2a4a;
    color: #555;
    cursor: not-allowed;
}

.area-size.too-big {
    color: #ff6b6b;
}

#progress {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    padding: 12px;
}

.step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    opacity: 0.35;
    transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease;
}

.step.active {
    opacity: 1;
}

.step.done {
    opacity: 1;
}

.step.done .step-icon::after {
    content: "\2713";
    color: #4CAF50;
    font-weight: bold;
}

.step.active .step-icon::after {
    content: "";
    width: 14px;
    height: 14px;
    border: 2px solid #4CAF50;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: block;
}

.step-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.step:not(.active):not(.done) .step-icon::after {
    content: "";
    width: 10px;
    height: 10px;
    background: #333;
    border-radius: 50%;
    display: block;
}

.step-text {
    font-size: 12px;
    color: #aaa;
}

.step-info {
    font-size: 11px;
    color: #666;
    font-family: 'SF Mono', 'Consolas', monospace;
    display: block;
    margin-top: 2px;
}

.step-content {
    display: flex;
    flex-direction: column;
}

.step.done .step-text {
    color: #4CAF50;
}

.step.done .step-info {
    color: #4CAF50;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#status {
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    font-size: 13px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.2);
}

#status a {
    color: #4CAF50;
    font-weight: 600;
    text-decoration: none;
    font-size: 15px;
}

#status a:hover {
    text-decoration: underline;
}

.size-note {
    font-size: 11px;
    color: #888;
    margin-top: 4px;
    font-family: 'SF Mono', 'Consolas', monospace;
}

.alt-download {
    margin-top: 3px;
}

.alt-download a {
    font-size: 12px !important;
    color: #888 !important;
    font-weight: 400 !important;
}

.coords-panel {
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    padding: 12px;
}

.coords-panel h3 {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.coords-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.coord-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.coord-label {
    font-size: 10px;
    color: #888;
    font-weight: 600;
    width: 14px;
}

.coord-value {
    font-size: 11px;
    color: #4CAF50;
    font-family: 'SF Mono', 'Consolas', monospace;
}

.area-size {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #2a2a4a;
    font-size: 12px;
    color: #aaa;
    text-align: center;
}

.legend {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #2a2a4a;
}

.legend h3 {
    margin-bottom: 8px;
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    font-size: 12px;
    color: #aaa;
}

.legend-item .color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid rgba(255,255,255,0.1);
}

#map {
    flex: 1;
    height: 100%;
    background: #0a0a1a;
}

.resize-handle {
    background: #4CAF50;
    border: 2px solid #fff;
    border-radius: 50%;
    width: 14px !important;
    height: 14px !important;
    cursor: grab;
    box-shadow: 0 1px 4px rgba(0,0,0,0.5);
    transition: transform 0.1s;
    z-index: 10000 !important;
}

.resize-handle:hover {
    transform: scale(1.5);
    background: #66bb6a;
}

.leaflet-interactive {
    pointer-events: none !important;
}

.resize-handle {
    pointer-events: auto !important;
}

.leaflet-draw-actions {
    display: none !important;
}

.leaflet-draw-edit-active {
    display: none !important;
}

.size-tooltip {
    background: rgba(0, 0, 0, 0.85) !important;
    color: #4CAF50 !important;
    border: 1px solid #4CAF50 !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    padding: 6px 12px !important;
    font-family: 'SF Mono', 'Consolas', monospace !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5) !important;
}

.size-tooltip::before {
    border-top-color: rgba(0, 0, 0, 0.85) !important;
}

.preview {
    position: absolute;
    right: 16px;
    bottom: 16px;
    width: 380px;
    height: 320px;
    background: #0f1424;
    border: 1px solid #2a2a4a;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.6);
    z-index: 1200;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.preview.hidden { display: none; }

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #16213e;
    border-bottom: 1px solid #2a2a4a;
    font-size: 12px;
    font-weight: 600;
    color: #cfd6e6;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.preview-header button {
    background: none;
    border: none;
    color: #888;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

.preview-header button:hover { color: #ff6b6b; }

#previewCanvas {
    flex: 1;
    width: 100%;
    min-height: 0;
}

#previewCanvas canvas { display: block; }

.preview-hint {
    padding: 5px 12px;
    font-size: 10px;
    color: #667;
    text-align: center;
    background: #0b0f1c;
    border-top: 1px solid #2a2a4a;
}

/* ---------- auth ---------- */

.auth-box { min-height: 34px; }

.auth-primary {
    width: 100%;
    padding: 10px;
    background: #2a3f6e;
    color: #e0e0e0;
    border: 1px solid #3a5088;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.auth-primary:hover:not(:disabled) { background: #34518e; }
.auth-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.auth-user {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #0f1830;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    padding: 8px 10px;
}

.auth-email {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    color: #9fb4d8;
}

.auth-secondary {
    background: none;
    border: 1px solid #3a5088;
    color: #9fb4d8;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 11px;
    cursor: pointer;
}

.auth-secondary:hover { background: #2a3f6e; color: #e0e0e0; }

/* ---------- modal ---------- */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 20, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.modal.hidden { display: none; }

.modal-card {
    position: relative;
    width: 320px;
    max-width: calc(100vw - 40px);
    background: #16213e;
    border: 1px solid #2a2a4a;
    border-radius: 12px;
    padding: 24px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    color: #888;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.modal-close:hover { color: #ff6b6b; }

.auth-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.auth-tab {
    flex: 1;
    padding: 8px;
    background: #0f1830;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    color: #888;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.auth-tab.active {
    background: #2a3f6e;
    border-color: #3a5088;
    color: #ffffff;
}

.auth-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-card input {
    width: 100%;
    padding: 10px;
    background: #0f1830;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 13px;
}

.modal-card input:focus {
    outline: none;
    border-color: #3a5088;
}

.auth-error {
    min-height: 16px;
    font-size: 12px;
    color: #ff6b6b;
}

.auth-link {
    display: inline-block;
    margin-top: 6px;
    font-size: 12px;
    color: #7ea6e0;
    text-decoration: none;
}

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

/* ---------- account page ---------- */

.account-body {
    overflow: auto;
}

.account-page {
    max-width: 760px;
    margin: 0 auto;
    padding: 24px 16px 60px;
}

.account-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 6px;
}

.account-header h1 {
    flex: 1;
    color: #ffffff;
    font-size: 20px;
}

.account-authbox { min-width: 220px; }

.quota-line {
    font-size: 12px;
    color: #888;
    margin-bottom: 16px;
}

.models-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.models-empty {
    color: #888;
    font-size: 14px;
    padding: 30px 0;
    text-align: center;
}

.model-card {
    display: flex;
    gap: 12px;
    align-items: center;
    background: #16213e;
    border: 1px solid #2a2a4a;
    border-radius: 10px;
    padding: 14px 16px;
}

.model-main { flex: 1; min-width: 0; }

.model-title {
    font-size: 14px;
    font-weight: 600;
    color: #e0e0e0;
}

.model-sub {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

.model-status {
    font-size: 12px;
    margin-top: 4px;
}

.status-done { color: #6fcf7c; }
.status-error, .status-cancelled { color: #ff6b6b; }
.status-queued, .status-running { color: #e8c268; }
.status-done.status-expired { color: #888; }

.model-progress {
    font-size: 12px;
    color: #9fb4d8;
    margin-top: 4px;
    min-height: 0;
}

.model-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
}

.model-btn {
    display: block;
    text-align: center;
    padding: 7px 14px;
    background: #0f1830;
    border: 1px solid #3a5088;
    border-radius: 7px;
    color: #9fb4d8;
    font-size: 12px;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.model-btn:hover:not(:disabled) { background: #2a3f6e; color: #e0e0e0; }
.model-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.model-btn.primary {
    background: linear-gradient(135deg, #4CAF50, #2e7d32);
    border-color: transparent;
    color: #ffffff;
    font-weight: 600;
}

.model-btn.primary:hover { background: linear-gradient(135deg, #5cbf60, #388e3c); }

.model-btn.danger { border-color: #6e2a2a; color: #d88; }
.model-btn.danger:hover:not(:disabled) { background: #4a1f1f; color: #ffb0b0; }

/* ---------- admin page ---------- */

.admin-page { max-width: 960px; }

.admin-h2 {
    color: #cfd6e6;
    font-size: 15px;
    margin: 22px 0 10px;
}

.admin-table-wrap {
    overflow-x: auto;
    border: 1px solid #2a2a4a;
    border-radius: 10px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: #16213e;
    font-size: 12px;
}

.admin-table th, .admin-table td {
    padding: 9px 12px;
    text-align: left;
    white-space: nowrap;
}

.admin-table th {
    color: #888;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 10px;
    border-bottom: 1px solid #2a2a4a;
}

.admin-table td { color: #d5dcea; border-bottom: 1px solid #1e2946; }
.admin-table tbody tr:last-child td { border-bottom: none; }

.admin-row { cursor: pointer; }
.admin-row:hover td { background: #1b2a50; }
.admin-row.selected td { background: #223464; }

.admin-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    background: #6e5a2a;
    color: #ffd98a;
    border-radius: 8px;
    font-size: 10px;
}

/* ---------- payments / buy credits ---------- */

.balance-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.balance-row .quota-line { margin-bottom: 0; }

.buy-card { width: 360px; }

.buy-title { color: #ffffff; font-size: 16px; margin-bottom: 2px; }

.buy-note { font-size: 11px; color: #888; margin-bottom: 10px; }

.packages-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.package-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: #0f1830;
    border: 1px solid #3a5088;
    border-radius: 8px;
    cursor: pointer;
    color: #e0e0e0;
    font-size: 13px;
}

.package-card:hover:not(:disabled) { background: #2a3f6e; }
.package-card:disabled { opacity: 0.6; cursor: wait; }

.package-credits { font-weight: 600; }

.package-price { color: #6fcf7c; font-weight: 700; font-size: 15px; }

/* ---------- admin settings editor ---------- */

.settings-form { margin-bottom: 28px; }

.settings-group {
    background: #16213e;
    border: 1px solid #1e2946;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 12px;
}

.settings-group-title {
    color: #8ab4ff;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
}

.settings-field {
    display: block;
    margin-bottom: 12px;
}

.settings-field > span {
    display: block;
    color: #d5dcea;
    font-size: 13px;
    margin-bottom: 4px;
}

.settings-field input[type=text],
.settings-field input[type=password],
.settings-field input[type=number],
.settings-packages input {
    width: 100%;
    max-width: 420px;
    box-sizing: border-box;
    padding: 8px 10px;
    background: #0f1830;
    border: 1px solid #3a5088;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 13px;
}

.settings-field input:focus, .settings-packages input:focus {
    outline: none;
    border-color: #8ab4ff;
}

.settings-field small {
    display: block;
    color: #888;
    font-size: 11px;
    margin-top: 4px;
}

.settings-restart {
    font-style: normal;
    color: #ffd98a;
    font-size: 11px;
}

.settings-packages input { max-width: 140px; }
.settings-packages .pkg-id { color: #888; }

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

.settings-msg { font-size: 13px; }
.settings-msg.is-ok { color: #6fcf7c; }
.settings-msg.is-error { color: #ff8a8a; }

/* ---------- language switcher + control hints ---------- */

.lang-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 4px;
}

.lang-select {
    background: #0f1830;
    border: 1px solid #3a5088;
    border-radius: 6px;
    color: #d5dcea;
    font-size: 12px;
    padding: 4px 6px;
    cursor: pointer;
}

.lang-select:focus { outline: none; border-color: #8ab4ff; }

.account-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.control-hint {
    display: block;
    color: #7a86a3;
    font-size: 11px;
    line-height: 1.45;
    margin-top: 4px;
}

/* ---------- welcome modal ---------- */

.welcome-card {
    width: 600px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.welcome-title {
    color: #ffffff;
    font-size: 20px;
    margin: 2px 24px 8px 0;
    line-height: 1.3;
}

.welcome-sub {
    color: #b8c2d8;
    font-size: 13px;
    line-height: 1.55;
    margin-bottom: 14px;
}

.welcome-steps {
    margin: 0 0 16px 18px;
    padding: 0;
    color: #d5dcea;
    font-size: 13px;
    line-height: 1.5;
}

.welcome-steps li { margin-bottom: 7px; }
.welcome-steps li::marker { color: #8ab4ff; font-weight: 700; }

.welcome-examples-title {
    color: #8ab4ff;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}

.welcome-examples {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.welcome-examples img {
    width: calc(33.33% - 6px);
    min-width: 0;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #2a3f6e;
    display: block;
}

.welcome-start { width: 100%; }

.how-link {
    font-size: 12px;
    margin-top: -8px;
}

/* ---------- sidebar / page footer ---------- */

.sidebar-footer {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid #1e2946;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 10.5px;
    color: #5d6883;
}

.sidebar-footer a {
    color: #8ab4ff;
    text-decoration: none;
    font-size: 11px;
}

.sidebar-footer a:hover { text-decoration: underline; }

.terms-footer {
    margin-top: 36px;
    border-top: 1px solid #1e2946;
}

/* ---------- terms page ---------- */

.terms-body h2 {
    color: #8ab4ff;
    font-size: 14px;
    margin: 22px 0 6px;
}

.terms-body p {
    color: #c7cfe0;
    font-size: 13px;
    line-height: 1.65;
}

.terms-contact {
    margin-top: 26px;
    color: #c7cfe0;
    font-size: 13px;
}

.terms-contact a { color: #8ab4ff; }

/* ---------- mobile ---------- */

@media (max-width: 820px) {
    html, body { overflow: auto; }

    .app {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    /* Map on top so the visitor immediately sees what to do; controls below. */
    #map {
        order: -1;
        flex: none;
        height: 48vh;
        min-height: 300px;
        width: 100%;
    }

    .sidebar {
        width: 100%;
        min-width: 0;
        height: auto;
        overflow-y: visible;
        padding: 16px;
    }

    .sidebar-footer { margin-top: 8px; }

    .preview {
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: 10px;
        width: auto;
        height: 42vh;
    }

    .modal-card { max-width: calc(100vw - 24px); }
    .welcome-card { padding: 18px; }
    .welcome-examples { flex-wrap: wrap; }
    .welcome-examples img { width: calc(50% - 4px); }
    .welcome-examples img:last-child { width: 100%; }

    .account-header { flex-wrap: wrap; }
    .account-header h1 { flex-basis: 100%; order: 3; margin-top: 6px; }
    .account-authbox { min-width: 0; }

    .balance-row { flex-wrap: wrap; }

    .model-card { flex-direction: column; align-items: stretch; gap: 10px; }
    .model-actions { display: flex; gap: 8px; flex-wrap: wrap; }
    .model-btn { padding: 10px 14px; }

    button, select, input { font-size: 14px; }
}

/* ==========================================================
   Cartographic workspace — auth and administration
   ========================================================== */

[hidden] { display: none !important; }

:focus-visible {
    outline: 3px solid rgba(47, 111, 85, 0.42);
    outline-offset: 3px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: fixed;
    z-index: 4000;
    top: 12px;
    left: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    background: #172019;
    color: #fff;
    text-decoration: none;
    transform: translateY(-160%);
    transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
}

.skip-link:focus { transform: translateY(0); }

.layer-mark {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 14px 8px 14px 8px;
    background: #dfece5;
    color: #2f6f55;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.76);
}

.layer-mark svg {
    width: 30px;
    height: 30px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.layer-mark-small {
    width: 42px;
    height: 42px;
    border-radius: 12px 7px 12px 7px;
}

.layer-mark-small svg { width: 26px; height: 26px; }

/* Authentication: one rare, spatial transition; frequent controls stay crisp. */

.modal {
    padding: 24px;
    overflow-y: auto;
    backdrop-filter: blur(12px);
}

.modal:not(.hidden) .auth-card {
    animation: auth-card-in 220ms cubic-bezier(0.23, 1, 0.32, 1) both;
}

@keyframes auth-card-in {
    from { opacity: 0; transform: translateY(12px) scale(.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-card {
    width: min(880px, calc(100vw - 48px));
    max-width: 880px;
    min-height: 540px;
    padding: 0;
    display: grid;
    grid-template-columns: minmax(0, 1.03fr) minmax(340px, .97fr);
    gap: 0;
    overflow: hidden;
    border: 1px solid rgba(223, 232, 225, .95);
    border-radius: 24px 11px 24px 11px;
    background: #fbfcfa;
    color: #172019;
    box-shadow: 0 28px 90px rgba(8, 25, 17, .34);
}

.auth-visual {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    min-width: 0;
    padding: 32px 34px 28px;
    display: flex;
    flex-direction: column;
    color: #edf5f0;
    background:
        radial-gradient(circle at 78% 12%, rgba(129, 177, 150, .28), transparent 30%),
        radial-gradient(circle at 24% 78%, rgba(55, 112, 83, .36), transparent 38%),
        #14231c;
}

.auth-visual::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0;
    opacity: .22;
    background-image:
        linear-gradient(rgba(207, 228, 216, .16) 1px, transparent 1px),
        linear-gradient(90deg, rgba(207, 228, 216, .16) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: linear-gradient(to bottom, transparent, #000 26%, #000);
}

.auth-visual-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.auth-visual .layer-mark {
    width: 44px;
    height: 44px;
    background: rgba(232, 244, 236, .11);
    color: #c7e6d3;
    border: 1px solid rgba(226, 242, 232, .18);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.1);
}

.auth-product {
    font-family: "Aptos Display", "Segoe UI Variable Display", "Segoe UI", sans-serif;
    font-size: 15px;
    font-weight: 650;
    letter-spacing: -.01em;
}

.auth-visual-copy {
    max-width: 420px;
    margin-top: 76px;
}

.auth-kicker,
.auth-form-index,
.section-kicker,
.section-index,
.metric-label {
    display: block;
    font-size: 11px;
    line-height: 1.3;
    font-weight: 650;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.auth-kicker { color: #9fc9af; }

.auth-visual h2 {
    margin-top: 13px;
    color: #f8fbf9;
    font-family: "Aptos Display", "Segoe UI Variable Display", "Segoe UI", sans-serif;
    font-size: clamp(30px, 4vw, 44px);
    line-height: .98;
    font-weight: 720;
    letter-spacing: -.045em;
    text-wrap: balance;
}

.auth-visual-copy p {
    max-width: 38ch;
    margin-top: 18px;
    color: #b7c9be;
    font-size: 14px;
    line-height: 1.65;
    text-wrap: pretty;
}

.auth-map-signature {
    position: relative;
    min-height: 178px;
    margin-top: auto;
    color: #8fbc9f;
}

.auth-map-signature svg {
    position: absolute;
    inset: 0 0 8px;
    width: 100%;
    height: 170px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.25;
    vector-effect: non-scaling-stroke;
}

.auth-map-signature circle {
    fill: #cce6d5;
    stroke: #14231c;
    stroke-width: 3;
}

.auth-map-signature .auth-map-pin {
    stroke-dasharray: 4 5;
    opacity: .72;
}

.auth-map-signature span {
    position: absolute;
    right: 0;
    bottom: 0;
    padding: 6px 8px;
    background: #14231c;
    color: #a8c5b2;
    font-family: ui-monospace, "Cascadia Mono", monospace;
    font-size: 10px;
    letter-spacing: .04em;
}

.auth-form-panel {
    position: relative;
    padding: 42px 40px 32px;
    display: flex;
    min-width: 0;
    flex-direction: column;
    background:
        radial-gradient(circle at 100% 0, rgba(219, 233, 225, .6), transparent 30%),
        #fbfcfa;
}

.auth-form-panel .modal-close {
    top: 18px;
    right: 20px;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #68726a;
    font-size: 26px;
    transition: color 160ms ease, background-color 160ms ease, transform 120ms ease-out;
}

.auth-form-panel .modal-close:hover {
    color: #172019;
    background: #edf1ed;
}

.auth-form-panel .modal-close:active { transform: scale(.94); }

.auth-form-heading { margin: 34px 0 22px; }

.auth-form-index { color: #2f6f55; }

.auth-form-heading p {
    margin-top: 7px;
    max-width: 34ch;
    color: #687269;
    font-size: 14px;
    line-height: 1.55;
}

.auth-card .auth-tabs {
    position: relative;
    padding: 4px;
    gap: 3px;
    margin-bottom: 22px;
    border: 1px solid #e0e5e0;
    border-radius: 11px;
    background: #f0f3f0;
}

.auth-card .auth-tab {
    min-height: 40px;
    padding: 8px 12px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #6e776f;
    font-size: 13px;
    font-weight: 620;
    transition: color 160ms ease, background-color 180ms ease, box-shadow 180ms ease, transform 120ms ease-out;
}

.auth-card .auth-tab.active {
    color: #172019;
    background: #fff;
    box-shadow: 0 2px 8px rgba(27, 49, 36, .08);
}

.auth-card .auth-tab:active { transform: scale(.97); }

.auth-card .auth-label {
    margin: 0 0 6px;
    color: #4b564e;
    font-size: 12px;
    font-weight: 620;
    letter-spacing: 0;
    text-transform: none;
}

.auth-input-shell {
    position: relative;
    margin-bottom: 15px;
}

.auth-input-shell > svg {
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 14px;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: #718078;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    transform: translateY(-50%);
    pointer-events: none;
}

.auth-card .auth-input-shell input {
    height: 48px;
    padding: 0 46px 0 42px;
    border: 1px solid #d9e0da;
    border-radius: 10px;
    background: #fff;
    color: #172019;
    font-family: inherit;
    font-size: 15px;
    box-shadow: inset 0 1px 0 rgba(23, 32, 25, .02);
    transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.auth-card .auth-input-shell input::placeholder { color: #9ba49d; }

.auth-card .auth-input-shell input:focus {
    outline: none;
    border-color: #2f6f55;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(47, 111, 85, .12);
}

.password-toggle {
    position: absolute;
    z-index: 2;
    top: 2px;
    right: 2px;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #718078;
    cursor: pointer;
    transition: color 160ms ease, background-color 160ms ease, transform 120ms ease-out;
}

.password-toggle svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
}

.password-toggle:hover { color: #2f6f55; background: #eff5f1; }
.password-toggle:active { transform: scale(.93); }
.password-toggle.is-visible { color: #2f6f55; }

.auth-card .auth-error {
    min-height: 20px;
    margin: -3px 0 8px;
    color: #a43b3b;
    font-size: 12px;
    line-height: 1.45;
}

.auth-submit {
    min-height: 48px;
    padding: 0 18px;
    border: 1px solid #275f49;
    border-radius: 10px;
    background: #2f6f55;
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 680;
    box-shadow: 0 7px 18px rgba(31, 83, 60, .18);
    transition: transform 140ms cubic-bezier(0.23, 1, 0.32, 1), background-color 180ms ease, box-shadow 180ms ease, opacity 160ms ease;
}

.auth-submit:hover:not(:disabled) {
    background: #285f49;
    box-shadow: 0 9px 22px rgba(31, 83, 60, .24);
}

.auth-submit:active:not(:disabled) { transform: scale(.97); }
.auth-submit:disabled { opacity: .58; cursor: wait; }

.auth-privacy {
    margin: 14px auto 0;
    max-width: 40ch;
    color: #808a82;
    font-size: 10px;
    line-height: 1.55;
    text-align: center;
}

/* Administration */

.admin-body {
    --admin-ink: #172019;
    --admin-muted: #687269;
    --admin-accent: #2f6f55;
    --admin-accent-soft: #dfece5;
    --admin-bg: #f1f4f0;
    --admin-surface: #fbfcfa;
    --admin-line: #dce3dc;
    --admin-danger: #a43b3b;
    --admin-warning: #8b651f;
    min-height: 100%;
    overflow: auto;
    background:
        radial-gradient(circle at 7% 3%, rgba(159, 197, 175, .2), transparent 22rem),
        linear-gradient(rgba(60, 96, 75, .035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(60, 96, 75, .035) 1px, transparent 1px),
        var(--admin-bg);
    background-size: auto, 44px 44px, 44px 44px, auto;
    color: var(--admin-ink);
    font-family: "Aptos", "Segoe UI Variable Text", "Segoe UI", sans-serif;
}

.admin-shell {
    width: min(1440px, calc(100% - 32px));
    margin: 0 auto;
    padding: 16px 0 64px;
}

.admin-topbar {
    position: sticky;
    z-index: 100;
    top: 16px;
    min-height: 66px;
    padding: 10px 12px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 24px;
    border: 1px solid rgba(213, 223, 215, .88);
    border-radius: 18px 9px 18px 9px;
    background: rgba(251, 252, 250, .9);
    box-shadow: 0 16px 44px rgba(29, 58, 40, .09), inset 0 1px 0 rgba(255,255,255,.8);
    backdrop-filter: blur(16px);
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    color: var(--admin-ink);
    text-decoration: none;
}

.admin-brand > span:last-child { display: grid; gap: 1px; }

.admin-brand strong {
    font-family: "Aptos Display", "Segoe UI Variable Display", "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.15;
    letter-spacing: -.02em;
}

.admin-brand small {
    color: var(--admin-muted);
    font-size: 10px;
    letter-spacing: .025em;
}

.admin-nav {
    display: flex;
    justify-content: center;
    gap: 4px;
}

.admin-nav a {
    min-height: 40px;
    padding: 0 13px;
    display: inline-flex;
    align-items: center;
    border-radius: 9px;
    color: #5e6860;
    font-size: 12px;
    font-weight: 570;
    text-decoration: none;
    transition: color 160ms ease, background-color 160ms ease, transform 120ms ease-out;
}

.admin-nav a:hover { color: var(--admin-ink); background: #edf2ee; }
.admin-nav a:active { transform: scale(.97); }

.admin-topbar .account-authbox { min-width: min(280px, 24vw); }

.admin-topbar .auth-user {
    min-height: 44px;
    border: 0;
    border-radius: 11px 6px 11px 6px;
    background: #e9efea;
    padding: 6px 7px 6px 12px;
}

.admin-topbar .auth-email { color: #445047; font-size: 11px; }

.admin-topbar .auth-secondary {
    min-height: 32px;
    border: 1px solid #d1d9d2;
    background: #fff;
    color: #536057;
    transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease, transform 120ms ease-out;
}

.admin-topbar .auth-secondary:hover {
    border-color: #bdc8c0;
    background: #f7f9f7;
    color: var(--admin-ink);
}

.admin-topbar .auth-secondary:active { transform: scale(.96); }
.admin-topbar .auth-link { display: none; }

.admin-main { padding: 72px 6px 0; }

.admin-intro {
    position: relative;
    min-height: 210px;
    padding: 34px 36px 42px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 30px;
    overflow: hidden;
    border-radius: 28px 12px 28px 12px;
    color: #eff6f1;
    background:
        radial-gradient(circle at 82% 24%, rgba(142, 184, 158, .25), transparent 26%),
        linear-gradient(115deg, #14231c 0%, #1d372a 72%, #244b38 100%);
    box-shadow: 0 24px 60px rgba(28, 60, 40, .16);
}

.admin-intro::after {
    content: "";
    position: absolute;
    top: -46%;
    right: 3%;
    width: 42%;
    aspect-ratio: 1;
    border: 1px solid rgba(205, 231, 214, .15);
    border-radius: 44% 56% 52% 48%;
    box-shadow:
        0 0 0 24px rgba(205, 231, 214, .05),
        0 0 0 52px rgba(205, 231, 214, .035),
        0 0 0 84px rgba(205, 231, 214, .02);
    transform: rotate(-12deg);
}

.admin-intro > * { position: relative; z-index: 1; }

.section-kicker { color: #9fc9af; }

.admin-intro h1 {
    margin-top: 10px;
    color: #f8fbf9;
    font-family: "Aptos Display", "Segoe UI Variable Display", "Segoe UI", sans-serif;
    font-size: clamp(34px, 5vw, 60px);
    line-height: .96;
    letter-spacing: -.052em;
    text-wrap: balance;
}

.admin-intro p {
    max-width: 58ch;
    margin-top: 16px;
    color: #b9cabe;
    font-size: 14px;
    line-height: 1.6;
    text-wrap: pretty;
}

.system-state {
    min-width: max-content;
    padding: 10px 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(219, 237, 226, .18);
    border-radius: 9px;
    background: rgba(236, 247, 240, .08);
    color: #dce9e0;
    font-size: 11px;
}

.system-state-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #8fd0a7;
    box-shadow: 0 0 0 4px rgba(143, 208, 167, .12);
}

.admin-metrics {
    position: relative;
    z-index: 2;
    margin: -22px 22px 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border: 1px solid var(--admin-line);
    border-radius: 16px 8px 16px 8px;
    background: rgba(251, 252, 250, .96);
    box-shadow: 0 18px 44px rgba(31, 61, 42, .1);
    overflow: hidden;
}

.metric-card {
    position: relative;
    min-height: 126px;
    padding: 22px 24px 19px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--admin-line);
}

.metric-card:last-child { border-right: 0; }

.metric-card-primary::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 44%;
    height: 3px;
    background: var(--admin-accent);
}

.metric-label { color: #758078; }

.metric-card strong {
    margin-top: 10px;
    color: var(--admin-ink);
    font-family: ui-monospace, "Cascadia Mono", monospace;
    font-size: clamp(23px, 2.5vw, 32px);
    line-height: 1;
    font-weight: 650;
    letter-spacing: -.045em;
    font-variant-numeric: tabular-nums;
}

.metric-card small {
    margin-top: auto;
    color: #879088;
    font-size: 10px;
}

.admin-section {
    margin-top: 28px;
    padding: 26px;
    border: 1px solid var(--admin-line);
    border-radius: 20px 9px 20px 9px;
    background: rgba(251, 252, 250, .96);
    box-shadow: 0 14px 38px rgba(32, 61, 43, .055);
}

.admin-section-head {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}

.section-index { color: var(--admin-accent); }

.admin-section h2 {
    margin-top: 5px;
    color: var(--admin-ink);
    font-family: "Aptos Display", "Segoe UI Variable Display", "Segoe UI", sans-serif;
    font-size: 23px;
    line-height: 1.15;
    letter-spacing: -.025em;
}

.admin-section-head > p {
    max-width: 42ch;
    color: var(--admin-muted);
    font-size: 12px;
    line-height: 1.5;
    text-align: right;
}

.admin-body .admin-table-wrap {
    border: 1px solid var(--admin-line);
    border-radius: 12px 6px 12px 6px;
    background: #fff;
}

.admin-body .admin-table {
    min-width: 860px;
    background: #fff;
    color: var(--admin-ink);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.admin-body .admin-table th,
.admin-body .admin-table td {
    padding: 13px 14px;
}

.admin-body .admin-table th {
    border-bottom: 1px solid var(--admin-line);
    background: #f5f7f4;
    color: #747e76;
    font-size: 10px;
    font-weight: 680;
}

.admin-body .admin-table td {
    border-bottom: 1px solid #e8ede8;
    color: #354139;
}

.admin-body .admin-row td {
    transition: color 150ms ease, background-color 150ms ease;
}

@media (hover: hover) and (pointer: fine) {
    .admin-body .admin-row:hover td { background: #f0f5f1; }
}

.admin-body .admin-row.selected td {
    background: #e5efe8;
    color: #1f4e3a;
}

.admin-body .admin-row.selected td:first-child {
    box-shadow: inset 3px 0 var(--admin-accent);
}

.admin-body .admin-badge {
    margin-left: 7px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #e9e2d0;
    color: #77581e;
    font-size: 9px;
    font-weight: 700;
}

.table-loading td { height: 64px; }

.table-loading td span,
.settings-loading span {
    display: inline-block;
    height: 10px;
    margin-right: 18px;
    border-radius: 4px;
    background: #e7ece7;
}

.table-loading td span:nth-child(1) { width: 22%; }
.table-loading td span:nth-child(2) { width: 12%; }
.table-loading td span:nth-child(3) { width: 31%; }

.admin-body .models-list { gap: 8px; }

.admin-body .model-card {
    border: 1px solid #e1e7e1;
    border-radius: 12px 6px 12px 6px;
    background: #f7f9f7;
    color: var(--admin-ink);
    transition: border-color 160ms ease, background-color 160ms ease, transform 140ms cubic-bezier(0.23, 1, 0.32, 1);
}

.admin-body .model-title { color: var(--admin-ink); }
.admin-body .model-sub { color: var(--admin-muted); }

.admin-body .status-done { color: var(--admin-accent); }
.admin-body .status-error,
.admin-body .status-cancelled { color: var(--admin-danger); }
.admin-body .status-queued,
.admin-body .status-running { color: var(--admin-warning); }

.admin-body .model-btn {
    min-height: 42px;
    padding: 0 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ced8d0;
    border-radius: 9px;
    background: #fff;
    color: #355d48;
    font-family: inherit;
    font-size: 12px;
    font-weight: 620;
    transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease, transform 120ms ease-out, opacity 160ms ease;
}

.admin-body .model-btn:hover:not(:disabled) {
    border-color: #aebfb3;
    background: #edf4ef;
    color: #224c38;
}

.admin-body .model-btn:active:not(:disabled) { transform: scale(.97); }
.admin-body .model-btn:disabled { opacity: .48; cursor: wait; }

.admin-body .settings-form { margin-bottom: 0; }

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

.admin-body .settings-group {
    margin: 0;
    padding: 18px;
    border: 0;
    border-radius: 13px 7px 13px 7px;
    background: #f1f5f1;
}

.admin-body .settings-group-wide { grid-column: 1 / -1; }

.admin-body .settings-group-title {
    margin-bottom: 16px;
    color: #2f6f55;
    font-size: 11px;
    font-weight: 700;
}

.admin-body .settings-field {
    margin-bottom: 15px;
}

.admin-body .settings-field:last-child { margin-bottom: 0; }

.admin-body .settings-field > span {
    color: #3d4941;
    font-size: 12px;
    font-weight: 620;
}

.admin-body .settings-field input[type=text],
.admin-body .settings-field input[type=password],
.admin-body .settings-field input[type=number],
.admin-body .settings-packages input {
    min-height: 44px;
    max-width: none;
    border: 1px solid #d5ddd6;
    border-radius: 9px;
    background: #fff;
    color: var(--admin-ink);
    font-family: inherit;
    font-size: 14px;
    transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.admin-body .settings-field input:focus,
.admin-body .settings-packages input:focus {
    outline: none;
    border-color: var(--admin-accent);
    box-shadow: 0 0 0 4px rgba(47, 111, 85, .1);
}

.admin-body .settings-field small {
    color: #7c867e;
    font-size: 10px;
    line-height: 1.5;
}

.admin-body .settings-restart {
    color: var(--admin-warning);
    font-size: 10px;
}

.admin-body .settings-packages { min-width: 560px; }
.admin-body .settings-packages input { min-width: 90px; }
.admin-body .settings-packages .pkg-id { color: #687269; }

.admin-body .settings-actions {
    min-height: 64px;
    margin-top: 16px;
    padding-top: 16px;
    justify-content: flex-end;
    border-top: 1px solid var(--admin-line);
}

.admin-body .settings-save {
    min-height: 46px;
    border-color: #275f49;
    background: var(--admin-accent);
    color: #fff;
    box-shadow: 0 8px 20px rgba(47, 111, 85, .16);
}

.admin-body .settings-save:hover:not(:disabled) {
    border-color: #23533f;
    background: #285f49;
    color: #fff;
}

.admin-body .settings-msg { color: var(--admin-muted); font-size: 12px; }
.admin-body .settings-msg.is-ok { color: var(--admin-accent); }
.admin-body .settings-msg.is-error { color: var(--admin-danger); }

.settings-loading {
    grid-column: 1 / -1;
    min-height: 150px;
    padding: 28px;
    display: grid;
    align-content: center;
    gap: 15px;
    border-radius: 13px 7px 13px 7px;
    background: #f1f5f1;
}

.settings-loading span { display: block; margin: 0; }
.settings-loading span:nth-child(1) { width: 24%; }
.settings-loading span:nth-child(2) { width: 72%; }
.settings-loading span:nth-child(3) { width: 55%; }

.admin-security {
    background:
        radial-gradient(circle at 94% 0, rgba(213, 227, 217, .7), transparent 25%),
        #fbfcfa;
}

.security-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.password-form .settings-actions { justify-content: flex-start; }

@media (max-width: 1080px) {
    .admin-nav { display: none; }
    .admin-topbar { grid-template-columns: 1fr auto; }
    .admin-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .metric-card:nth-child(2) { border-right: 0; }
    .metric-card:nth-child(-n+2) { border-bottom: 1px solid var(--admin-line); }
    .security-fields { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .modal { padding: 12px; align-items: flex-start; }

    .auth-card {
        width: min(100%, 520px);
        min-height: 0;
        margin: auto;
        grid-template-columns: 1fr;
        border-radius: 18px 8px 18px 8px;
    }

    .auth-visual { min-height: 218px; padding: 22px 24px; }
    .auth-visual-copy { margin-top: 34px; }
    .auth-visual h2 { max-width: 14ch; font-size: 32px; }
    .auth-visual-copy p { display: none; }
    .auth-map-signature { position: absolute; right: 14px; bottom: 0; width: 46%; min-height: 130px; opacity: .58; }
    .auth-map-signature span { display: none; }
    .auth-form-panel { padding: 26px 24px 24px; }
    .auth-form-heading { margin: 24px 0 18px; }

    .admin-shell { width: min(100% - 20px, 720px); padding-top: 10px; }
    .admin-topbar { top: 10px; padding: 8px; gap: 10px; }
    .admin-topbar .account-authbox { min-width: 0; }
    .admin-topbar .auth-user { background: transparent; padding-left: 4px; }
    .admin-topbar .auth-email { display: none; }
    .admin-main { padding: 44px 0 0; }
    .admin-intro { min-height: 240px; padding: 28px 24px 34px; align-items: flex-start; flex-direction: column; justify-content: flex-end; }
    .admin-intro h1 { font-size: 42px; }
    .admin-intro p { font-size: 13px; }
    .system-state { align-self: flex-start; }
    .admin-metrics { margin: -18px 10px 0; }
    .metric-card { min-height: 112px; padding: 18px; }
    .admin-section { margin-top: 18px; padding: 20px 16px; }
    .admin-section-head { align-items: flex-start; flex-direction: column; gap: 9px; }
    .admin-section-head > p { text-align: left; }
    .settings-grid { grid-template-columns: 1fr; }
    .settings-actions { align-items: flex-start; flex-direction: column; }
    .admin-body .settings-save { width: 100%; }
}

@media (max-width: 460px) {
    .auth-visual { min-height: 192px; }
    .auth-visual h2 { font-size: 28px; }
    .auth-product { font-size: 13px; }
    .auth-map-signature { width: 54%; }
    .auth-form-panel { padding: 22px 18px 20px; }
    .auth-form-panel .modal-close { top: 10px; right: 10px; }

    .admin-brand small { display: none; }
    .admin-topbar .auth-secondary { padding: 4px 9px; }
    .admin-intro { border-radius: 20px 8px 20px 8px; }
    .admin-intro h1 { font-size: 36px; }
    .admin-metrics { grid-template-columns: 1fr; }
    .metric-card { min-height: 104px; border-right: 0; border-bottom: 1px solid var(--admin-line); }
    .metric-card:last-child { border-bottom: 0; }
    .admin-body .model-actions { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
    .modal:not(.hidden) .auth-card { animation: none; }
    .skip-link,
    .auth-submit,
    .auth-card .auth-tab,
    .password-toggle,
    .admin-nav a,
    .admin-body .model-btn {
        transition-duration: 1ms;
    }
}

/* ==========================================================
   Map workspace — light cartographic workbench
   ========================================================== */

.map-workspace {
    --map-paper: #f4f6f2;
    --map-surface: rgba(252, 253, 250, .965);
    --map-ink: #14221b;
    --map-muted: #66736a;
    --map-line: #dce4dd;
    --map-accent: #2f6f55;
    --map-accent-soft: #e2eee6;
    --map-shadow: rgba(35, 69, 51, .15);
    display: grid;
    grid-template-rows: 72px minmax(0, 1fr);
    min-height: 100dvh;
    overflow: hidden;
    background: var(--map-paper);
    color: var(--map-ink);
    font-family: "Aptos", "Segoe UI Variable Text", "Segoe UI", sans-serif;
}

.workspace-topbar {
    position: relative;
    z-index: 1400;
    height: 72px;
    padding: 0 24px;
    display: grid;
    grid-template-columns: minmax(190px, 1fr) auto minmax(190px, 1fr);
    align-items: center;
    gap: 28px;
    border-bottom: 1px solid #dfe6df;
    background:
        radial-gradient(circle at 8% -90%, rgba(111, 154, 129, .18), transparent 42%),
        rgba(249, 251, 248, .96);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .8);
}

.workspace-brand {
    width: max-content;
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: var(--map-ink);
    text-decoration: none;
}

.workspace-brand-mark {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px 5px 12px 5px;
    background: #234e3b;
    box-shadow: 0 7px 16px rgba(35, 78, 59, .18);
}

.workspace-brand-mark svg {
    width: 27px;
    height: 27px;
    fill: none;
    stroke: #f7faf7;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.workspace-brand > span:last-child {
    display: grid;
    gap: 1px;
}

.workspace-brand strong {
    font-family: "Aptos Display", "Segoe UI Variable Display", "Segoe UI", sans-serif;
    font-size: 18px;
    line-height: 1;
    letter-spacing: -.035em;
}

.workspace-brand small {
    color: #758178;
    font-size: 9px;
    font-weight: 650;
    letter-spacing: .11em;
    text-transform: uppercase;
}

.workspace-flow {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid #dbe3dc;
    border-radius: 10px 5px 10px 5px;
    background: #fff;
}

.workspace-flow > span {
    min-height: 38px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #7a857d;
    font-size: 11px;
    font-weight: 620;
    white-space: nowrap;
}

.workspace-flow > span + span {
    border-left: 1px solid #e4e9e4;
}

.workspace-flow b {
    color: #a2aba4;
    font-family: "Cascadia Mono", Consolas, monospace;
    font-size: 9px;
    font-weight: 650;
}

.workspace-flow .is-active {
    background: var(--map-accent-soft);
    color: #23533f;
}

.workspace-flow .is-active b { color: var(--map-accent); }

.workspace-status {
    justify-self: end;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #59665d;
    font-size: 11px;
    font-weight: 620;
}

.workspace-status i,
.map-intro-meta i {
    width: 7px;
    height: 7px;
    display: inline-block;
    border-radius: 50%;
    background: #4c9b6d;
    box-shadow: 0 0 0 4px rgba(76, 155, 109, .12);
}

.map-workspace .app {
    position: relative;
    display: block;
    width: 100%;
    height: auto;
    min-height: 0;
    overflow: hidden;
}

.map-stage {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background: #dfe7df;
}

.map-workspace #map {
    width: 100%;
    height: 100%;
    background: #dfe7df;
    filter: saturate(.72) contrast(.96) brightness(1.035);
}

.map-workspace .sidebar {
    position: absolute;
    z-index: 1200;
    top: 18px;
    right: 18px;
    bottom: 18px;
    width: 372px;
    min-width: 0;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-x: hidden;
    overflow-y: auto;
    border: 1px solid rgba(210, 221, 212, .96);
    border-radius: 22px 9px 22px 9px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .86), transparent 32%),
        var(--map-surface);
    color: var(--map-ink);
    box-shadow:
        0 24px 64px var(--map-shadow),
        inset 0 1px 0 rgba(255, 255, 255, .9);
    scrollbar-width: thin;
    scrollbar-color: #bdcbbf transparent;
}

.map-workspace .sidebar::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 102px;
    height: 3px;
    background: var(--map-accent);
}

.map-workspace .lang-row {
    position: absolute;
    top: 17px;
    right: 18px;
    margin: 0;
}

.map-workspace .lang-select {
    min-height: 34px;
    padding: 0 28px 0 10px;
    border: 1px solid #d5ded6;
    border-radius: 8px;
    background: #f7f9f6;
    color: #445148;
    font-size: 11px;
    transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.map-workspace .lang-select:focus {
    outline: none;
    border-color: var(--map-accent);
    box-shadow: 0 0 0 4px rgba(47, 111, 85, .1);
}

.panel-kicker,
.map-intro-kicker {
    color: var(--map-accent);
    font-size: 9px;
    font-weight: 750;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.map-workspace .panel-kicker {
    max-width: 170px;
    margin-top: 2px;
}

.map-workspace .sidebar h1 {
    max-width: 230px;
    color: var(--map-ink);
    font-family: "Aptos Display", "Segoe UI Variable Display", "Segoe UI", sans-serif;
    font-size: 28px;
    font-weight: 680;
    line-height: 1.04;
    letter-spacing: -.045em;
    text-align: left;
    text-wrap: balance;
}

.map-workspace .subtitle {
    max-width: 29ch;
    margin: -7px 0 2px;
    color: var(--map-muted);
    font-size: 11px;
    line-height: 1.45;
    text-align: left;
}

.map-workspace .how-link {
    width: max-content;
    margin: -2px 0 0;
    color: var(--map-accent);
    font-size: 11px;
    font-weight: 650;
    text-decoration: none;
}

.map-workspace .how-link::after {
    content: " ↗";
    display: inline-block;
    transition: transform 150ms cubic-bezier(.23, 1, .32, 1);
}

.map-workspace .auth-box {
    min-height: 42px;
}

.map-workspace .auth-box .auth-primary {
    min-height: 42px;
    border: 1px solid #d5ded6;
    border-radius: 10px 5px 10px 5px;
    background: #f3f6f3;
    color: #254c39;
    font-size: 12px;
    box-shadow: none;
    transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease, transform 120ms cubic-bezier(.23, 1, .32, 1);
}

.map-workspace .auth-user {
    padding: 8px 10px;
    border: 1px solid #d5ded6;
    border-radius: 10px 5px 10px 5px;
    background: #f3f6f3;
    color: #334139;
}

.map-workspace .auth-email { color: #334139; }

.map-workspace .auth-secondary {
    border-color: #d5ded6;
    background: #f3f6f3;
    color: #526057;
}

.map-workspace .auth-link {
    color: var(--map-accent);
}

.map-workspace .auth-box > .auth-link {
    display: inline-flex;
    margin: 8px 12px 0 0;
    font-size: 10px;
    font-weight: 650;
    text-decoration: none;
}

.map-workspace .control-group {
    position: relative;
    gap: 8px;
    padding: 14px 0;
    border-top: 1px solid #e2e8e2;
}

.map-workspace .control-group label {
    color: #344139;
    font-size: 10px;
    font-weight: 720;
    letter-spacing: .07em;
}

.map-workspace .control-group select {
    min-height: 44px;
    padding: 0 38px 0 12px;
    border: 1px solid #d4ddd5;
    border-radius: 10px 5px 10px 5px;
    background: #f7f9f6;
    color: #223129;
    font-size: 13px;
    transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.map-workspace .control-group select:focus {
    outline: none;
    border-color: var(--map-accent);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(47, 111, 85, .1);
}

.map-workspace input[type=range] {
    height: 4px;
    border-radius: 99px;
    background: #dce5dd;
}

.map-workspace input[type=range]::-webkit-slider-thumb {
    width: 18px;
    height: 18px;
    border: 4px solid #f9fbf9;
    border-radius: 50%;
    background: var(--map-accent);
    box-shadow: 0 1px 5px rgba(34, 79, 59, .28);
    transition: transform 140ms cubic-bezier(.23, 1, .32, 1);
}

.map-workspace #heightValue,
.map-workspace #exaggerationValue {
    position: absolute;
    top: 11px;
    right: 0;
    color: var(--map-accent);
    font-family: "Cascadia Mono", Consolas, monospace;
    font-size: 11px;
}

.map-workspace .control-hint {
    margin-top: 2px;
    color: #7a857d;
    font-size: 10px;
    line-height: 1.45;
}

.map-workspace .checkbox-label {
    min-height: 44px;
    justify-content: space-between;
    color: #344139 !important;
}

.map-workspace .checkbox-label span { order: 1; }

.map-workspace .checkbox-label input[type=checkbox] {
    order: 2;
    width: 40px;
    height: 22px;
    flex: 0 0 auto;
    appearance: none;
    position: relative;
    border: 1px solid #c9d4cb;
    border-radius: 99px;
    background: #dfe6e0;
    transition: background-color 180ms ease, border-color 180ms ease;
}

.map-workspace .checkbox-label input[type=checkbox]::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(25, 48, 35, .2);
    transition: transform 180ms cubic-bezier(.23, 1, .32, 1);
}

.map-workspace .checkbox-label input[type=checkbox]:checked {
    border-color: var(--map-accent);
    background: var(--map-accent);
}

.map-workspace .checkbox-label input[type=checkbox]:checked::after {
    transform: translateX(18px);
}

.map-workspace #generateBtn {
    min-height: 50px;
    padding: 0 16px;
    border: 1px solid #285f49;
    border-radius: 12px 5px 12px 5px;
    background: var(--map-accent);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: none;
    box-shadow: 0 10px 24px rgba(47, 111, 85, .2);
    transition: background-color 180ms ease, box-shadow 180ms ease, transform 140ms cubic-bezier(.23, 1, .32, 1), opacity 180ms ease;
}

.map-workspace #generateBtn::before {
    content: "↗";
    margin-right: 9px;
}

.map-workspace #generateBtn:disabled {
    border-color: #d9e0da;
    background: #e9eeea;
    color: #9aa39c;
    box-shadow: none;
}

.map-workspace #status {
    min-height: 0;
    padding: 11px 12px;
    border: 1px solid #dce5dd;
    border-radius: 9px;
    background: #f2f6f2;
    color: #445148;
    font-size: 11px;
}

.map-workspace #status:empty { display: none; }
.map-workspace #status a { color: var(--map-accent); }

.map-workspace #progress {
    position: relative;
    gap: 0;
    padding: 34px 13px 10px;
    border: 1px solid #e0e7e1;
    border-radius: 12px 6px 12px 6px;
    background: #f4f7f4;
}

.map-workspace #progress::before {
    content: "MODEL PIPELINE";
    position: absolute;
    top: 11px;
    left: 13px;
    color: #7a857d;
    font-size: 8px;
    font-weight: 750;
    letter-spacing: .12em;
}

.map-workspace .step {
    min-height: 29px;
    padding: 4px 0;
}

.map-workspace .step-icon { width: 17px; height: 17px; }
.map-workspace .step-text { color: #536057; font-size: 10px; }
.map-workspace .step-info { color: #7c877f; font-size: 9px; }

.map-workspace .step:not(.active):not(.done) .step-icon::after {
    width: 6px;
    height: 6px;
    background: #bac5bc;
}

.map-workspace .step.active .step-icon::after {
    width: 11px;
    height: 11px;
    border-color: var(--map-accent);
    border-top-color: transparent;
}

.map-workspace .step.done .step-icon::after,
.map-workspace .step.done .step-text,
.map-workspace .step.done .step-info {
    color: var(--map-accent);
}

.map-workspace .coords-panel {
    padding: 13px;
    border: 1px solid #dfe7e0;
    border-radius: 12px 6px 12px 6px;
    background: #f6f8f5;
}

.map-workspace .coords-panel h3,
.map-workspace .legend h3 {
    color: #737f76;
    font-size: 8px;
    font-weight: 750;
    letter-spacing: .12em;
}

.map-workspace .coords-grid { gap: 7px 12px; }
.map-workspace .coord-label { color: #849087; }

.map-workspace .coord-value {
    color: #335f49;
    font-size: 10px;
}

.map-workspace .area-size {
    border-color: #dfe6df;
    color: #435047;
    font-family: "Cascadia Mono", Consolas, monospace;
    font-size: 10px;
}

.map-workspace .legend {
    margin-top: 0;
    padding-top: 12px;
    border-color: #e1e7e1;
}

.map-workspace .legend h3 { margin-bottom: 9px; }

.map-workspace .legend-item {
    margin-bottom: 5px;
    color: #657168;
    font-size: 10px;
}

.map-workspace .legend-item .color {
    width: 12px;
    height: 12px;
    border-color: rgba(35, 52, 42, .12);
    border-radius: 3px;
}

.map-workspace .sidebar-footer {
    margin-top: 0;
    padding-top: 11px;
    border-color: #e1e7e1;
    color: #89928b;
    font-size: 9px;
}

.map-workspace .sidebar-footer a {
    color: var(--map-accent);
    font-size: 10px;
}

.map-intro {
    position: absolute;
    z-index: 900;
    top: 22px;
    left: 22px;
    width: min(340px, calc(100% - 440px));
    padding: 17px 19px 16px;
    overflow: hidden;
    border: 1px solid rgba(213, 223, 214, .94);
    border-radius: 22px 8px 22px 8px;
    background:
        radial-gradient(circle at 100% 0, rgba(101, 145, 119, .16), transparent 36%),
        rgba(251, 253, 249, .94);
    box-shadow: 0 18px 52px rgba(36, 69, 51, .13);
    backdrop-filter: blur(14px);
}

.map-intro::after {
    content: "";
    position: absolute;
    right: -42px;
    bottom: -54px;
    width: 180px;
    height: 120px;
    border: 1px solid rgba(47, 111, 85, .16);
    border-radius: 50%;
    box-shadow:
        0 0 0 16px rgba(47, 111, 85, .055),
        0 0 0 36px rgba(47, 111, 85, .035);
    transform: rotate(-12deg);
    pointer-events: none;
}

.map-intro h2 {
    max-width: 15ch;
    margin-top: 6px;
    color: var(--map-ink);
    font-family: "Aptos Display", "Segoe UI Variable Display", "Segoe UI", sans-serif;
    font-size: clamp(25px, 2vw, 32px);
    font-weight: 690;
    line-height: .98;
    letter-spacing: -.055em;
    text-wrap: balance;
}

.map-intro > p {
    max-width: 46ch;
    margin-top: 10px;
    color: #66736a;
    font-size: 12px;
    line-height: 1.48;
    text-wrap: pretty;
}

.map-intro-meta {
    margin-top: 11px;
    padding-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 9px 18px;
    border-top: 1px solid #dde5de;
}

.map-intro-meta > span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #4f5d53;
    font-size: 10px;
    font-weight: 620;
}

.map-intro-meta i {
    width: 5px;
    height: 5px;
    box-shadow: 0 0 0 3px rgba(76, 155, 109, .11);
}

.map-command {
    position: absolute;
    z-index: 900;
    left: 22px;
    bottom: 22px;
    min-height: 62px;
    padding: 10px 18px 10px 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(211, 221, 212, .94);
    border-radius: 14px 6px 14px 6px;
    background: rgba(252, 253, 250, .94);
    box-shadow: 0 15px 40px rgba(36, 69, 51, .12);
    backdrop-filter: blur(12px);
}

.map-command-index {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 10px 4px 10px 4px;
    background: var(--map-accent);
    color: #fff;
    font-family: "Cascadia Mono", Consolas, monospace;
    font-size: 11px;
    font-weight: 700;
}

.map-command > span:last-child {
    display: grid;
    gap: 2px;
}

.map-command strong {
    color: #233229;
    font-size: 11px;
    font-weight: 700;
}

.map-command small {
    color: #7a857d;
    font-size: 9px;
}

.map-command.is-complete .map-command-index {
    background: #1f513a;
}

.map-workspace .leaflet-top.leaflet-left {
    top: 244px;
    left: 12px;
}

.map-workspace .leaflet-bar {
    overflow: hidden;
    border: 1px solid #d6dfd7;
    border-radius: 10px 4px 10px 4px;
    box-shadow: 0 10px 26px rgba(35, 69, 51, .14);
}

.map-workspace .leaflet-bar a {
    position: relative;
    width: 38px;
    height: 38px;
    line-height: 38px;
    border-color: #e1e7e1;
    background: rgba(253, 254, 252, .96);
    color: #345443;
}

.map-workspace .leaflet-draw-toolbar a {
    background-image: none !important;
}

.map-workspace .leaflet-draw-toolbar a::before,
.map-workspace .leaflet-draw-toolbar a::after {
    content: "";
    position: absolute;
    pointer-events: none;
}

.map-workspace .leaflet-draw-draw-rectangle::before {
    inset: 10px;
    border: 2px solid #315c47;
    border-radius: 2px;
}

.map-workspace .leaflet-draw-draw-rectangle::after {
    right: 7px;
    bottom: 7px;
    width: 5px;
    height: 5px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #315c47;
}

.map-workspace .leaflet-draw-draw-circle::before {
    inset: 9px;
    border: 2px solid #315c47;
    border-radius: 50%;
}

.map-workspace .leaflet-draw-edit-edit::before {
    top: 17px;
    left: 10px;
    width: 18px;
    height: 4px;
    border-radius: 3px;
    background: #315c47;
    transform: rotate(-42deg);
}

.map-workspace .leaflet-draw-edit-edit::after {
    top: 9px;
    right: 9px;
    width: 5px;
    height: 5px;
    border: 2px solid #315c47;
    border-radius: 50%;
    background: #fff;
}

.map-workspace .leaflet-draw-edit-remove::before,
.map-workspace .leaflet-draw-edit-remove::after {
    top: 18px;
    left: 10px;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: #8c554d;
}

.map-workspace .leaflet-draw-edit-remove::before { transform: rotate(45deg); }
.map-workspace .leaflet-draw-edit-remove::after { transform: rotate(-45deg); }

.map-workspace .leaflet-disabled {
    opacity: .42;
}

.map-workspace .leaflet-control-attribution {
    padding: 3px 7px;
    border-radius: 5px 0 0 0;
    background: rgba(255, 255, 255, .82);
    color: #66736a;
    font-size: 9px;
}

.map-workspace .resize-handle {
    width: 15px !important;
    height: 15px !important;
    border: 3px solid #fff;
    background: var(--map-accent);
    box-shadow: 0 2px 8px rgba(28, 62, 45, .3);
}

.map-workspace .size-tooltip {
    border-color: #285f49 !important;
    background: rgba(31, 61, 45, .92) !important;
    color: #fff !important;
}

.map-workspace .welcome-card {
    border: 1px solid #d9e3da;
    border-radius: 22px 9px 22px 9px;
    background: #fbfcfa;
    color: var(--map-ink);
    box-shadow: 0 28px 80px rgba(24, 50, 35, .22);
}

.map-workspace .welcome-title { color: var(--map-ink); }
.map-workspace .welcome-sub,
.map-workspace .welcome-steps { color: #5d6a61; }
.map-workspace .welcome-steps li::marker,
.map-workspace .welcome-examples-title { color: var(--map-accent); }
.map-workspace .welcome-examples img { border-color: #d8e2d9; }

@media (hover: hover) and (pointer: fine) {
    .workspace-brand:hover .workspace-brand-mark { background: #1d4433; }
    .map-workspace .how-link:hover::after { transform: translate(2px, -2px); }
    .map-workspace .auth-box .auth-primary:hover:not(:disabled) {
        border-color: #b8c9bb;
        background: #e8f0ea;
        color: #1f513a;
    }
    .map-workspace #generateBtn:hover:not(:disabled) {
        background: #285f49;
        box-shadow: 0 13px 27px rgba(47, 111, 85, .27);
        transform: translateY(-1px);
    }
    .map-workspace input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.12); }
}

.map-workspace .workspace-brand:active,
.map-workspace .auth-box .auth-primary:active:not(:disabled),
.map-workspace #generateBtn:active:not(:disabled) {
    transform: scale(.97);
}

@media (max-width: 1040px) {
    .workspace-topbar {
        grid-template-columns: 1fr auto;
    }

    .workspace-flow { display: none; }

    .map-workspace .sidebar {
        top: auto;
        left: 14px;
        right: 14px;
        bottom: 14px;
        width: auto;
        height: min(48dvh, 510px);
        padding: 20px;
    }

    .map-intro {
        width: min(340px, calc(100% - 44px));
    }

    .map-command { display: none; }
}

@media (max-width: 680px) {
    .map-workspace {
        grid-template-rows: 62px minmax(0, 1fr);
    }

    .workspace-topbar {
        height: 62px;
        padding: 0 14px;
    }

    .workspace-brand-mark {
        width: 34px;
        height: 34px;
    }

    .workspace-brand strong { font-size: 16px; }
    .workspace-brand small { display: none; }
    .workspace-status span { display: none; }

    .map-intro {
        top: 12px;
        left: 12px;
        width: calc(100% - 24px);
        padding: 14px 16px;
    }

    .map-intro h2 {
        max-width: 18ch;
        margin-top: 5px;
        font-size: 24px;
    }

    .map-intro > p {
        margin-top: 7px;
        font-size: 10px;
        line-height: 1.4;
    }

    .map-intro-meta { margin-top: 8px; padding-top: 8px; }
    .map-intro-meta > span { font-size: 9px; }
    .map-workspace .leaflet-top.leaflet-left { top: 204px; left: 2px; }

    .map-workspace .sidebar {
        left: 8px;
        right: 8px;
        bottom: 8px;
        height: 52dvh;
        padding: 18px;
        border-radius: 18px 7px 18px 7px;
    }

    .map-workspace .sidebar h1 { font-size: 25px; }
}

@media (prefers-reduced-motion: reduce) {
    .map-workspace .workspace-brand,
    .map-workspace .workspace-brand-mark,
    .map-workspace .how-link::after,
    .map-workspace .auth-box .auth-primary,
    .map-workspace #generateBtn,
    .map-workspace input[type=range]::-webkit-slider-thumb,
    .map-workspace .checkbox-label input[type=checkbox],
    .map-workspace .checkbox-label input[type=checkbox]::after {
        transition-duration: 1ms;
    }
}

/* ==========================================================
   Shared product language — concept, builder and back office
   ========================================================== */

:root {
    --product-paper: #f5f7f6;
    --product-surface: #ffffff;
    --product-surface-soft: #eef1f4;
    --product-ink: #0c1727;
    --product-muted: #5c6878;
    --product-line: #dfe4e8;
    --product-accent: #5b55df;
    --product-accent-dark: #443dc0;
    --product-accent-soft: #ecebff;
    --product-navy: #0a1626;
    --product-danger: #ad3f4b;
    --product-warning: #8a6319;
    --product-shadow: rgba(12, 23, 39, .12);
}

:focus-visible {
    outline-color: rgba(91, 85, 223, .48);
}

.layer-mark {
    border-radius: 12px;
    background: var(--product-accent-soft);
    color: var(--product-accent);
}

.skip-link {
    background: var(--product-navy);
}

/* Builder */

.map-workspace {
    --map-paper: var(--product-paper);
    --map-surface: rgba(255, 255, 255, .97);
    --map-ink: var(--product-ink);
    --map-muted: var(--product-muted);
    --map-line: var(--product-line);
    --map-accent: var(--product-accent);
    --map-accent-soft: var(--product-accent-soft);
    --map-shadow: rgba(12, 23, 39, .15);
}

.workspace-topbar {
    grid-template-columns: minmax(210px, 1fr) auto minmax(330px, 1fr);
    border-color: var(--product-line);
    background:
        radial-gradient(circle at 8% -90%, rgba(91, 85, 223, .13), transparent 42%),
        rgba(255, 255, 255, .96);
}

.workspace-brand-mark {
    border-radius: 12px 5px 12px 5px;
    background: var(--product-accent);
    box-shadow: 0 8px 18px rgba(91, 85, 223, .24);
}

.workspace-brand small {
    color: #707b8b;
}

.workspace-flow {
    border-color: var(--product-line);
    border-radius: 11px;
}

.workspace-flow > span {
    min-height: 40px;
    color: #707b8b;
}

.workspace-flow > span + span {
    border-color: #e8eaf0;
}

.workspace-flow .is-active {
    color: var(--product-accent-dark);
}

.workspace-header-actions {
    min-width: 0;
    justify-self: end;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
}

.workspace-info-link {
    min-height: 40px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    border-radius: 9px;
    color: #4f5b6a;
    font-size: 12px;
    font-weight: 650;
    text-decoration: none;
    transition: color 160ms ease, background-color 160ms ease, transform 120ms ease-out;
}

.workspace-info-link:hover {
    color: var(--product-ink);
    background: var(--product-surface-soft);
}

.workspace-info-link:active {
    transform: scale(.97);
}

.workspace-status {
    color: #536070;
}

.workspace-status i,
.map-intro-meta i {
    background: var(--product-accent);
    box-shadow: 0 0 0 4px rgba(91, 85, 223, .12);
}

.workspace-authbox {
    min-height: 42px;
    display: flex;
    align-items: center;
}

.workspace-authbox > .auth-primary {
    width: auto;
    min-height: 42px;
    padding: 0 17px;
    border: 1px solid var(--product-accent);
    border-radius: 10px;
    background: var(--product-accent);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 7px 17px rgba(91, 85, 223, .2);
    transition: background-color 160ms ease, box-shadow 160ms ease, transform 120ms ease-out;
}

.workspace-authbox > .auth-primary:hover:not(:disabled) {
    background: var(--product-accent-dark);
    box-shadow: 0 9px 21px rgba(91, 85, 223, .27);
}

.workspace-authbox .auth-user {
    min-height: 42px;
    padding: 5px 6px 5px 11px;
    border: 1px solid var(--product-line);
    border-radius: 10px;
    background: var(--product-surface-soft);
}

.workspace-authbox .auth-email {
    max-width: 132px;
    color: #465263;
    font-size: 11px;
}

.workspace-authbox .auth-secondary {
    min-height: 30px;
    border: 1px solid #d8dce5;
    background: #fff;
    color: #566171;
}

.workspace-authbox > .auth-link {
    margin: 0 0 0 8px;
    color: var(--product-accent);
    font-size: 11px;
    font-weight: 650;
}

.map-workspace .sidebar {
    border-color: rgba(217, 221, 232, .98);
    border-radius: 20px;
    box-shadow: 0 24px 64px var(--map-shadow), inset 0 1px 0 #fff;
}

.map-workspace .sidebar::before {
    width: 112px;
}

.map-workspace .lang-select,
.map-workspace .control-group select {
    border-color: #daddE7;
    border-radius: 10px;
    background: #f8f9fb;
    color: var(--product-ink);
}

.map-workspace .lang-select:focus,
.map-workspace .control-group select:focus {
    box-shadow: 0 0 0 4px rgba(91, 85, 223, .11);
}

.map-workspace .control-group {
    border-color: #e5e7ed;
}

.map-workspace input[type=range] {
    background: #dfe1eb;
}

.map-workspace input[type=range]::-webkit-slider-thumb {
    box-shadow: 0 1px 5px rgba(91, 85, 223, .28);
}

.map-workspace .checkbox-label input[type=checkbox] {
    border-color: #cfd3df;
    background: #dfe2e9;
}

.map-workspace #generateBtn {
    border-color: var(--product-accent);
    border-radius: 11px;
    box-shadow: 0 10px 24px rgba(91, 85, 223, .22);
}

.map-workspace #generateBtn:hover:not(:disabled) {
    background: var(--product-accent-dark);
    box-shadow: 0 13px 27px rgba(91, 85, 223, .28);
}

.map-workspace #status,
.map-workspace #progress,
.map-workspace .coords-panel {
    border-color: #e0e3eb;
    background: #f7f8fa;
}

.map-workspace .coord-value {
    color: var(--product-accent-dark);
}

.map-intro {
    border-color: rgba(218, 222, 232, .96);
    border-radius: 20px;
    background:
        radial-gradient(circle at 100% 0, rgba(91, 85, 223, .13), transparent 36%),
        rgba(255, 255, 255, .95);
    box-shadow: 0 18px 52px rgba(12, 23, 39, .13);
}

.map-intro::after {
    border-color: rgba(91, 85, 223, .17);
    box-shadow:
        0 0 0 16px rgba(91, 85, 223, .05),
        0 0 0 36px rgba(91, 85, 223, .03);
}

.map-intro > p {
    color: var(--product-muted);
}

.map-intro-meta {
    border-color: #e1e4eb;
}

.map-command {
    border-color: rgba(218, 222, 232, .96);
    border-radius: 14px;
    background: rgba(255, 255, 255, .95);
    box-shadow: 0 15px 40px rgba(12, 23, 39, .12);
}

.map-command-index {
    border-radius: 9px;
}

.map-command.is-complete .map-command-index {
    background: var(--product-accent-dark);
}

.map-workspace .leaflet-bar {
    border-color: #dadee8;
    border-radius: 10px;
    box-shadow: 0 10px 26px rgba(12, 23, 39, .14);
}

.map-workspace .leaflet-bar a {
    border-color: #e5e7ed;
    color: var(--product-accent-dark);
}

.map-workspace .leaflet-draw-draw-rectangle::before,
.map-workspace .leaflet-draw-draw-circle::before {
    border-color: var(--product-accent);
}

.map-workspace .leaflet-draw-draw-rectangle::after,
.map-workspace .leaflet-draw-edit-edit::before {
    background: var(--product-accent);
}

.map-workspace .leaflet-draw-edit-edit::after {
    border-color: var(--product-accent);
}

.map-workspace .size-tooltip {
    border-color: var(--product-accent-dark) !important;
    background: rgba(68, 61, 192, .94) !important;
}

.map-workspace .welcome-card {
    border-color: var(--product-line);
    border-radius: 20px;
    background: var(--product-surface);
    box-shadow: 0 28px 80px rgba(12, 23, 39, .22);
}

/* Authentication */

.auth-card {
    border-color: rgba(223, 228, 232, .96);
    border-radius: 22px;
    background: var(--product-surface);
    color: var(--product-ink);
    box-shadow: 0 28px 90px rgba(10, 22, 38, .34);
}

.auth-visual {
    color: #f1f0ff;
    background:
        radial-gradient(circle at 78% 12%, rgba(117, 111, 240, .32), transparent 30%),
        radial-gradient(circle at 24% 78%, rgba(91, 85, 223, .28), transparent 38%),
        var(--product-navy);
}

.auth-visual::before {
    background-image:
        linear-gradient(rgba(213, 211, 255, .15) 1px, transparent 1px),
        linear-gradient(90deg, rgba(213, 211, 255, .15) 1px, transparent 1px);
}

.auth-visual .layer-mark {
    border-color: transparent;
    border-radius: 12px 5px 12px 5px;
    background: var(--product-accent);
    color: #fff;
    box-shadow: 0 8px 18px rgba(91, 85, 223, .24);
}

.auth-kicker,
.auth-form-index {
    color: #aaa6ff;
}

.auth-visual-copy p {
    color: #bdc3d0;
}

.auth-map-signature {
    color: #8d88f3;
}

.auth-map-signature circle {
    fill: #d3d0ff;
    stroke: var(--product-navy);
}

.auth-map-signature span {
    background: var(--product-navy);
    color: #b7b4f6;
}

.auth-form-panel {
    background:
        radial-gradient(circle at 100% 0, rgba(236, 235, 255, .92), transparent 31%),
        var(--product-surface);
}

.auth-form-panel .modal-close {
    color: #6c7685;
}

.auth-form-panel .modal-close:hover {
    color: var(--product-ink);
    background: var(--product-surface-soft);
}

.auth-card .auth-tabs {
    border-color: var(--product-line);
    background: var(--product-surface-soft);
}

.auth-card .auth-tab {
    color: #6a7585;
}

.auth-card .auth-tab.active {
    color: var(--product-ink);
}

.auth-card .auth-input-shell input {
    border-color: #d9dde6;
    color: var(--product-ink);
}

.auth-card .auth-input-shell input:focus {
    border-color: var(--product-accent);
    box-shadow: 0 0 0 4px rgba(91, 85, 223, .11);
}

.password-toggle:hover,
.password-toggle.is-visible {
    color: var(--product-accent);
}

.password-toggle:hover {
    background: var(--product-accent-soft);
}

.auth-submit {
    border-color: var(--product-accent);
    background: var(--product-accent);
    box-shadow: 0 7px 18px rgba(91, 85, 223, .2);
}

.auth-submit:hover:not(:disabled) {
    background: var(--product-accent-dark);
    box-shadow: 0 9px 22px rgba(91, 85, 223, .27);
}

/* Account and legal pages */

.account-body {
    min-height: 100%;
    overflow: auto;
    background:
        radial-gradient(circle at 6% 0, rgba(91, 85, 223, .12), transparent 25rem),
        linear-gradient(rgba(91, 85, 223, .025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(91, 85, 223, .025) 1px, transparent 1px),
        var(--product-paper);
    background-size: auto, 44px 44px, 44px 44px, auto;
    color: var(--product-ink);
    font-family: "Aptos", "Segoe UI Variable Text", "Segoe UI", sans-serif;
}

.account-page {
    width: min(1120px, calc(100% - 32px));
    max-width: none;
    margin: 0 auto;
    padding: 16px 0 56px;
}

.account-topbar {
    position: sticky;
    z-index: 100;
    top: 16px;
    min-height: 66px;
    padding: 10px 12px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 24px;
    border: 1px solid rgba(219, 223, 232, .9);
    border-radius: 16px;
    background: rgba(255, 255, 255, .91);
    box-shadow: 0 16px 44px rgba(12, 23, 39, .08);
    backdrop-filter: blur(16px);
}

.account-nav {
    display: flex;
    justify-content: center;
    gap: 4px;
}

.account-nav a {
    min-height: 40px;
    padding: 0 13px;
    display: inline-flex;
    align-items: center;
    border-radius: 9px;
    color: #596576;
    font-size: 12px;
    font-weight: 620;
    text-decoration: none;
    transition: color 160ms ease, background-color 160ms ease, transform 120ms ease-out;
}

.account-nav a:hover {
    color: var(--product-ink);
    background: var(--product-surface-soft);
}

.account-nav a:active {
    transform: scale(.97);
}

.account-header-right {
    min-width: 0;
}

.account-header-right .lang-select {
    min-height: 40px;
    padding: 0 10px;
    border: 1px solid var(--product-line);
    border-radius: 9px;
    background: #f8f9fb;
    color: #4f5b6a;
}

.account-authbox {
    min-width: min(280px, 25vw);
}

.account-authbox .auth-user {
    min-height: 42px;
    border: 0;
    border-radius: 10px;
    background: var(--product-surface-soft);
    padding: 6px 7px 6px 12px;
}

.account-authbox .auth-email {
    color: #465263;
}

.account-authbox .auth-secondary {
    min-height: 30px;
    border: 1px solid #d8dce5;
    background: #fff;
    color: #566171;
}

.account-main {
    padding: 64px 6px 0;
}

.account-intro {
    min-height: 220px;
    padding: 34px 36px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
    border-radius: 24px;
    color: #f5f5ff;
    background:
        radial-gradient(circle at 84% 20%, rgba(117, 111, 240, .28), transparent 28%),
        linear-gradient(120deg, var(--product-navy), #151e4b 76%, #28237c);
    box-shadow: 0 24px 60px rgba(12, 23, 39, .16);
}

.account-intro .section-kicker {
    color: #aaa6ff;
}

.account-intro h1,
.terms-heading h1 {
    margin-top: 9px;
    font-family: "Aptos Display", "Segoe UI Variable Display", "Segoe UI", sans-serif;
    font-size: clamp(36px, 5vw, 58px);
    line-height: .98;
    letter-spacing: -.05em;
}

.account-intro h1 {
    color: #fff;
}

.account-intro p {
    max-width: 52ch;
    margin-top: 14px;
    color: #c0c6d4;
    font-size: 14px;
    line-height: 1.6;
}

.account-intro .balance-row {
    min-width: 230px;
    margin: 0;
    padding: 14px;
    align-items: stretch;
    flex-direction: column;
    border: 1px solid rgba(219, 218, 255, .16);
    border-radius: 12px;
    background: rgba(255, 255, 255, .08);
}

.account-intro .quota-line {
    margin: 0;
    color: #d7d9e7;
    font-size: 13px;
    line-height: 1.5;
}

.account-content {
    margin-top: 22px;
    padding: 26px;
    border: 1px solid var(--product-line);
    border-radius: 18px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 14px 38px rgba(12, 23, 39, .055);
}

.account-body .model-card {
    padding: 15px 16px;
    border: 1px solid #e1e4eb;
    border-radius: 12px;
    background: #f8f9fb;
    color: var(--product-ink);
}

.account-body .model-title {
    color: var(--product-ink);
}

.account-body .model-sub,
.account-body .models-empty {
    color: var(--product-muted);
}

.account-body .model-btn {
    min-height: 40px;
    border-color: #d4d8e2;
    border-radius: 9px;
    background: #fff;
    color: var(--product-accent-dark);
}

.account-body .model-btn:hover:not(:disabled) {
    border-color: #bbb9ef;
    background: var(--product-accent-soft);
    color: var(--product-accent-dark);
}

.account-body .model-btn.primary {
    border-color: var(--product-accent);
    background: var(--product-accent);
    color: #fff;
}

.account-body .model-btn.primary:hover:not(:disabled) {
    background: var(--product-accent-dark);
    color: #fff;
}

.account-body .model-btn.danger {
    border-color: #e0bcc1;
    color: var(--product-danger);
}

.account-body .admin-h2 {
    color: var(--product-ink);
}

.account-body .admin-table-wrap {
    border-color: var(--product-line);
    background: #fff;
}

.account-body .admin-table {
    background: #fff;
    color: var(--product-ink);
}

.account-body .admin-table th {
    border-color: var(--product-line);
    background: #f5f6f9;
    color: #6b7686;
}

.account-body .admin-table td {
    border-color: #e8eaf0;
    color: #354153;
}

.account-body .sidebar-footer {
    border-color: var(--product-line);
    color: #788392;
}

.account-body .sidebar-footer a,
.account-body .terms-contact a {
    color: var(--product-accent);
}

.buy-card {
    border-color: var(--product-line);
    background: #fff;
    color: var(--product-ink);
}

.buy-title {
    color: var(--product-ink);
}

.buy-note {
    color: var(--product-muted);
}

.package-card {
    border-color: #d8dce6;
    background: #f7f8fa;
    color: var(--product-ink);
}

.package-card:hover:not(:disabled) {
    background: var(--product-accent-soft);
}

.package-price {
    color: var(--product-accent-dark);
}

.terms-main {
    margin-top: 64px;
}

.terms-heading {
    padding: 34px 36px;
    border-radius: 22px;
    background:
        radial-gradient(circle at 92% 0, rgba(91, 85, 223, .14), transparent 32%),
        #fff;
    border: 1px solid var(--product-line);
}

.terms-heading .section-kicker {
    color: var(--product-accent);
}

.terms-heading h1 {
    color: var(--product-ink);
}

.terms-body {
    margin-top: 18px;
    padding: 28px 36px 36px;
    border: 1px solid var(--product-line);
    border-radius: 18px;
    background: #fff;
}

.terms-body h2 {
    color: var(--product-accent-dark);
    font-size: 16px;
}

.terms-body p,
.terms-contact {
    max-width: 76ch;
    color: #4e5a6b;
    font-size: 14px;
    line-height: 1.72;
}

/* Administration */

.admin-body {
    --admin-ink: var(--product-ink);
    --admin-muted: var(--product-muted);
    --admin-accent: var(--product-accent);
    --admin-accent-soft: var(--product-accent-soft);
    --admin-bg: var(--product-paper);
    --admin-surface: var(--product-surface);
    --admin-line: var(--product-line);
    --admin-danger: var(--product-danger);
    --admin-warning: var(--product-warning);
    background:
        radial-gradient(circle at 7% 3%, rgba(91, 85, 223, .12), transparent 22rem),
        linear-gradient(rgba(91, 85, 223, .025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(91, 85, 223, .025) 1px, transparent 1px),
        var(--admin-bg);
    background-size: auto, 44px 44px, 44px 44px, auto;
}

.admin-topbar {
    border-color: rgba(219, 223, 232, .9);
    border-radius: 16px;
    background: rgba(255, 255, 255, .91);
    box-shadow: 0 16px 44px rgba(12, 23, 39, .08);
}

.admin-brand strong {
    font-size: 16px;
}

.admin-brand .layer-mark {
    border-radius: 12px 5px 12px 5px;
    background: var(--product-accent);
    color: #fff;
    box-shadow: 0 8px 18px rgba(91, 85, 223, .2);
}

.admin-brand small {
    color: #707b8b;
}

.admin-nav a {
    color: #596576;
    font-size: 12px;
    font-weight: 620;
}

.admin-nav a:hover {
    color: var(--product-ink);
    background: var(--product-surface-soft);
}

.admin-topbar .auth-user {
    background: var(--product-surface-soft);
}

.admin-topbar .auth-email {
    color: #465263;
}

.admin-intro {
    border-radius: 24px;
    color: #f5f5ff;
    background:
        radial-gradient(circle at 82% 24%, rgba(117, 111, 240, .3), transparent 27%),
        linear-gradient(115deg, var(--product-navy) 0%, #161f4c 72%, #2b267e 100%);
    box-shadow: 0 24px 60px rgba(12, 23, 39, .16);
}

.admin-intro::after {
    border-color: rgba(218, 216, 255, .16);
    box-shadow:
        0 0 0 24px rgba(218, 216, 255, .05),
        0 0 0 52px rgba(218, 216, 255, .03),
        0 0 0 84px rgba(218, 216, 255, .02);
}

.section-kicker {
    color: #aaa6ff;
}

.admin-intro p {
    color: #c0c6d4;
}

.system-state {
    border-color: rgba(219, 218, 255, .18);
    color: #e5e4ff;
}

.system-state-dot {
    background: #aaa6ff;
    box-shadow: 0 0 0 4px rgba(170, 166, 255, .13);
}

.admin-metrics,
.admin-section {
    border-color: var(--product-line);
    border-radius: 16px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 18px 44px rgba(12, 23, 39, .08);
}

.metric-card {
    border-color: var(--product-line);
}

.admin-body .admin-table th {
    background: #f5f6f9;
}

.admin-body .admin-row.selected td {
    background: var(--product-accent-soft);
    color: var(--product-accent-dark);
}

.admin-body .model-card,
.admin-body .settings-group,
.settings-loading {
    background: #f7f8fa;
    border-color: #e1e4eb;
}

.admin-body .settings-group-title {
    color: var(--product-accent);
}

.admin-body .settings-field input:focus,
.admin-body .settings-packages input:focus {
    box-shadow: 0 0 0 4px rgba(91, 85, 223, .1);
}

.admin-body .settings-save {
    border-color: var(--product-accent);
    background: var(--product-accent);
    box-shadow: 0 8px 20px rgba(91, 85, 223, .18);
}

.admin-body .settings-save:hover:not(:disabled) {
    border-color: var(--product-accent-dark);
    background: var(--product-accent-dark);
}

@media (max-width: 1180px) {
    .workspace-topbar {
        grid-template-columns: minmax(190px, 1fr) auto minmax(260px, 1fr);
        gap: 18px;
    }

    .workspace-status {
        display: none;
    }
}

@media (max-width: 1040px) {
    .workspace-topbar {
        grid-template-columns: 1fr auto;
    }

    .workspace-header-actions {
        gap: 8px;
    }

    .workspace-info-link {
        display: none;
    }
}

@media (max-width: 820px) {
    .account-page {
        width: min(100% - 20px, 720px);
        padding-top: 10px;
    }

    .account-topbar {
        top: 10px;
        grid-template-columns: 1fr auto;
        gap: 10px;
        padding: 8px;
    }

    .account-nav {
        display: none;
    }

    .account-authbox {
        min-width: 0;
    }

    .account-authbox .auth-email {
        display: none;
    }

    .account-main,
    .terms-main {
        padding-top: 44px;
        margin-top: 0;
    }

    .account-intro {
        min-height: 280px;
        padding: 28px 24px;
        align-items: flex-start;
        flex-direction: column;
        justify-content: flex-end;
    }

    .account-intro .balance-row {
        width: 100%;
        min-width: 0;
    }

    .account-content {
        padding: 20px 16px;
    }

    .terms-heading,
    .terms-body {
        padding: 24px 20px;
    }
}

@media (max-width: 680px) {
    .workspace-authbox > .auth-primary {
        min-height: 38px;
        padding: 0 13px;
    }

    .workspace-authbox .auth-email,
    .map-workspace .workspace-authbox > .auth-link {
        display: none;
    }

    .map-workspace .workspace-authbox > .auth-link:first-of-type {
        margin-left: 5px;
        display: inline-flex;
        font-size: 10px;
        white-space: nowrap;
    }

    .workspace-authbox .auth-user {
        background: transparent;
        border: 0;
        padding: 0;
    }

    .workspace-authbox .auth-secondary {
        min-height: 36px;
    }

    .account-intro h1,
    .terms-heading h1 {
        font-size: 38px;
    }
}

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

    .workspace-brand {
        gap: 8px;
    }

    .workspace-brand-mark {
        width: 32px;
        height: 32px;
    }

    .workspace-brand strong {
        font-size: 15px;
    }

    .account-topbar .admin-brand small {
        display: none;
    }

    .account-header-right {
        gap: 7px;
    }

    .account-header-right .lang-select {
        width: 54px;
        padding: 0 5px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .workspace-info-link,
    .workspace-authbox > .auth-primary,
    .account-nav a {
        transition-duration: 1ms;
    }
}

/* 3D preview stays inside the map workspace and never covers settings. */

.map-workspace .preview {
    right: 408px;
    bottom: 22px;
    width: clamp(320px, 36vw, 460px);
    height: clamp(280px, 42vh, 380px);
    border: 1px solid rgba(117, 111, 240, .34);
    border-radius: 16px;
    background: var(--product-navy);
    box-shadow: 0 22px 60px rgba(10, 22, 38, .3);
}

.map-workspace .preview-header {
    min-height: 46px;
    padding: 0 8px 0 15px;
    border-color: rgba(199, 196, 255, .14);
    background: #111d31;
    color: #e8e7ff;
    font-size: 11px;
    letter-spacing: .07em;
}

.map-workspace .preview-header button {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    color: #aeb6c4;
    transition: color 160ms ease, background-color 160ms ease, transform 120ms ease-out;
}

.map-workspace .preview-header button:hover {
    color: #fff;
    background: rgba(236, 235, 255, .1);
}

.map-workspace .preview-header button:active {
    transform: scale(.94);
}

.map-workspace .preview-hint {
    min-height: 30px;
    padding: 7px 12px;
    border-color: rgba(199, 196, 255, .12);
    background: #0d1829;
    color: #949fb0;
}

.map-workspace:has(.preview:not(.hidden)) .map-command {
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 1040px) {
    .map-workspace .preview {
        position: absolute;
        top: 14px;
        right: 14px;
        bottom: calc(min(48dvh, 510px) + 28px);
        left: 14px;
        width: auto;
        height: auto;
        min-height: 210px;
    }
}

@media (max-width: 680px) {
    .map-workspace .preview {
        top: 8px;
        right: 8px;
        bottom: calc(52dvh + 20px);
        left: 8px;
        min-height: 190px;
        border-radius: 14px;
    }
}

@media (max-width: 1040px) and (max-height: 560px) {
    .map-workspace .preview {
        min-height: 0;
    }

    .map-workspace .preview-hint {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .map-workspace .preview-header button {
        transition-duration: 1ms;
    }
}

/* Experimental data source: compact, explicit and visually separate from
   geometry controls. The violet edge ties it to the shared product language. */
.map-workspace .source-control {
    padding: 10px 0 14px;
}

.map-workspace .source-option {
    min-height: 72px;
    margin: 0;
    padding: 12px;
    align-items: flex-start;
    gap: 14px;
    border: 1px solid #dfe2eb;
    border-radius: 12px;
    background: #f8f9fc;
    cursor: pointer;
    transition:
        border-color 180ms ease,
        background-color 180ms ease,
        box-shadow 180ms ease,
        transform 120ms ease-out;
}

.map-workspace .source-option:active {
    transform: scale(.992);
}

.map-workspace .source-copy {
    min-width: 0;
    display: grid;
    gap: 5px;
}

.map-workspace .source-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--product-ink);
    font-size: 12px;
    font-weight: 760;
    letter-spacing: .02em;
}

.map-workspace .source-copy > .source-title,
.map-workspace .source-title > span {
    order: 0;
}

.map-workspace .source-badge {
    order: 0;
    padding: 3px 6px;
    border: 1px solid rgba(91, 85, 223, .22);
    border-radius: 999px;
    background: rgba(91, 85, 223, .07);
    color: var(--product-accent);
    font-family: "Cascadia Mono", Consolas, monospace;
    font-size: 8px;
    font-weight: 720;
    letter-spacing: .08em;
    line-height: 1;
    text-transform: uppercase;
}

.map-workspace .source-option .control-hint {
    order: 1;
    color: #687386;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0;
    line-height: 1.45;
}

.map-workspace .source-option input[type=checkbox] {
    margin-top: 1px;
}

.map-workspace .source-control.is-active .source-option {
    border-color: rgba(91, 85, 223, .48);
    background: #f4f3ff;
    box-shadow: 0 8px 22px rgba(91, 85, 223, .11);
}

.map-workspace .detailed-option {
    position: relative;
    min-height: 68px;
    margin: 10px 2px 0 14px;
    padding: 11px 12px 11px 14px;
    align-items: flex-start;
    gap: 12px;
    border: 1px solid #e2e4ec;
    border-radius: 11px;
    background: #fff;
    cursor: pointer;
    transition: border-color 180ms ease, background-color 180ms ease, opacity 180ms ease;
}

.map-workspace .detailed-option::before {
    content: "";
    position: absolute;
    top: -11px;
    bottom: 18px;
    left: -9px;
    width: 1px;
    background: #d9dce8;
}

.map-workspace .detailed-option .control-hint {
    color: #626d7d;
    font-size: 12px;
    line-height: 1.5;
}

.map-workspace .detailed-option.is-active {
    border-color: rgba(91, 85, 223, .42);
    background: #f7f6ff;
}

.map-workspace .detailed-option.is-disabled {
    opacity: .48;
    cursor: not-allowed;
}

.map-workspace .detailed-option:has(input:focus-visible) {
    outline: 3px solid rgba(91, 85, 223, .17);
    outline-offset: 2px;
}

.map-workspace .source-option:has(input:focus-visible) {
    outline: 3px solid rgba(91, 85, 223, .17);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .map-workspace .source-option {
        transition-duration: 1ms;
    }
}

/* ==========================================================
   Builder readability pass
   Keep operational text readable and download actions contained.
   ========================================================== */

@media (min-width: 1041px) {
    .map-workspace .sidebar {
        width: 400px;
        padding: 24px;
        gap: 16px;
    }

    .map-workspace .preview {
        right: 436px;
    }
}

.workspace-brand small {
    font-size: 10px;
}

.workspace-flow > span,
.workspace-status {
    font-size: 12px;
}

.workspace-flow b {
    font-size: 10px;
}

.map-workspace .panel-kicker,
.map-intro-kicker {
    font-size: 11px;
    line-height: 1.3;
}

.map-workspace .sidebar h1 {
    max-width: 260px;
}

.map-workspace .subtitle {
    max-width: 32ch;
    font-size: 13px;
    line-height: 1.55;
}

.map-workspace .how-link,
.map-workspace .auth-box > .auth-link {
    font-size: 12px;
}

.map-workspace .control-group {
    gap: 10px;
    padding: 15px 0;
}

.map-workspace .control-group label {
    color: #3e4858;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .015em;
    line-height: 1.35;
    text-transform: none;
}

.map-workspace .control-group select {
    font-size: 14px;
}

.map-workspace #heightValue,
.map-workspace #exaggerationValue {
    font-size: 12px;
}

.map-workspace .control-hint,
.map-workspace .source-option .control-hint {
    color: #626d7d;
    font-size: 12px;
    line-height: 1.55;
}

.map-workspace .source-option {
    min-height: 82px;
    padding: 14px;
}

.map-workspace .source-title {
    font-size: 13px;
}

.map-workspace .source-badge {
    font-size: 9px;
}

.map-workspace #generateBtn {
    min-height: 52px;
    font-size: 14px;
}

.map-workspace #progress {
    padding: 38px 15px 12px;
}

.map-workspace #progress::before {
    font-size: 10px;
}

.map-workspace .step {
    min-height: 34px;
    opacity: .58;
}

.map-workspace .step-text {
    font-size: 12px;
    line-height: 1.35;
}

.map-workspace .step-info {
    font-size: 11px;
    line-height: 1.4;
}

.map-workspace #status {
    width: 100%;
    min-width: 0;
    min-height: 70px;
    padding: 12px;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    font-size: 13px;
    line-height: 1.45;
    overflow: hidden;
}

.map-workspace #status a {
    width: 100%;
    min-width: 0;
    min-height: 46px;
    padding: 9px 12px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--product-accent);
    border-radius: 9px;
    background: var(--product-accent);
    color: #fff !important;
    font-size: 13px !important;
    font-weight: 720;
    line-height: 1.3;
    text-align: center;
    text-decoration: none;
    white-space: normal;
    overflow-wrap: anywhere;
    box-shadow: 0 8px 18px rgba(91, 85, 223, .2);
    transition:
        background-color 160ms ease,
        box-shadow 160ms ease,
        transform 120ms cubic-bezier(.23, 1, .32, 1);
}

.map-workspace #status a:active {
    transform: scale(.97);
}

.map-workspace #status .size-note {
    margin: 0;
    color: #667181;
    font-size: 12px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.map-workspace .coords-panel h3,
.map-workspace .legend h3 {
    font-size: 10px;
}

.map-workspace .coord-label {
    font-size: 11px;
}

.map-workspace .coord-value,
.map-workspace .area-size {
    font-size: 12px;
}

.map-workspace .legend-item {
    font-size: 12px;
    line-height: 1.35;
}

.map-workspace .legend-item .color {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
}

.map-workspace .sidebar-footer,
.map-workspace .sidebar-footer a {
    font-size: 11px;
    line-height: 1.5;
}

.map-intro > p {
    font-size: 13px;
}

.map-intro-meta > span {
    font-size: 11px;
}

.map-command strong {
    font-size: 13px;
}

.map-command small {
    font-size: 11px;
}

.map-command-index {
    font-size: 12px;
}

.map-workspace .preview-header {
    font-size: 12px;
}

.map-workspace .preview-hint {
    font-size: 11px;
    line-height: 1.4;
}

.account-body .model-actions {
    min-width: 0;
    max-width: 100%;
}

.account-body .model-btn {
    max-width: 100%;
    font-size: 13px;
    line-height: 1.3;
    white-space: normal;
    overflow-wrap: anywhere;
    transition:
        color 160ms ease,
        border-color 160ms ease,
        background-color 160ms ease,
        transform 120ms cubic-bezier(.23, 1, .32, 1);
}

.account-body .model-btn:active {
    transform: scale(.97);
}

@media (hover: hover) and (pointer: fine) {
    .map-workspace #status a:hover {
        background: var(--product-accent-dark);
        box-shadow: 0 10px 22px rgba(91, 85, 223, .26);
        text-decoration: none;
    }
}

@media (max-width: 1040px) {
    .map-workspace .sidebar {
        width: auto;
        padding: 22px;
    }

    .map-workspace .preview {
        right: 14px;
    }
}

@media (max-width: 680px) {
    .map-workspace .sidebar {
        padding: 18px;
    }

    .map-intro > p {
        font-size: 12px;
    }

    .map-intro-meta > span {
        font-size: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .map-workspace #status a,
    .account-body .model-btn {
        transition-duration: 1ms;
    }
}
