:root{font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:#17212b;background:#f3f6f8;font-synthesis:none;font-optical-sizing:auto}*{box-sizing:border-box}body{margin:0}.topbar{display:flex;justify-content:space-between;align-items:center;padding:24px max(24px,calc((100vw - 1180px)/2));background:#101e2a;color:#fff}.topbar h1{font-size:23px;margin:5px 0 0}.eyebrow{font-size:10px;letter-spacing:.14em;font-weight:700;color:#7390a5}.topbar .eyebrow{color:#91aaba}.layout{max-width:1180px;margin:26px auto;padding:0 20px 60px;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}.panel,.login-card{background:#fff;border:1px solid #e2e9ed;border-radius:14px;padding:22px;box-shadow:0 3px 12px #192a3810}.wide{grid-column:1/-1}h2{font-size:19px;margin:6px 0 18px}.panel p{line-height:1.55}.muted{color:#657783}.small{font-size:12px}.section-heading{display:flex;justify-content:space-between;align-items:center}.form-stack{display:grid;gap:13px}label{display:grid;gap:6px;font-size:13px;font-weight:650}input,select,textarea{width:100%;padding:10px 11px;border:1px solid #cdd8df;border-radius:8px;background:white;color:#17212b;font:inherit;font-size:14px}textarea{resize:vertical}.check{display:flex;align-items:center;gap:8px}.check input{width:auto}button{font:inherit;font-size:13px;font-weight:650;border:0;border-radius:8px;padding:10px 14px;cursor:pointer}.primary{background:#1468d4;color:#fff}.secondary{background:#e9f1f7;color:#1c4465}.quiet{background:transparent;color:inherit;padding:8px}.setup-form{display:grid;grid-template-columns:1fr auto;align-items:end;gap:12px}.progress-track{height:8px;background:#edf1f3;border-radius:20px;margin-top:16px;overflow:hidden}.progress-track div{height:100%;width:0;background:#2d8c5c;transition:width .3s}.service-message{font-weight:650}.badge{display:inline-block;border-radius:20px;background:#edf3f8;color:#31536c;padding:5px 9px;font-size:11px;white-space:nowrap}.badge.green{background:#e2f5e9;color:#22673d}.badge.gray{background:#edf0f2;color:#77828a}.tile-list{display:grid;gap:9px;margin-bottom:16px}.tile-row{display:grid;grid-template-columns:minmax(100px,.5fr) 1.5fr auto;gap:10px;align-items:center;padding:10px;background:#f6f8f9;border-radius:8px}.tile-row code{overflow-wrap:anywhere}.divider{border-top:1px solid #e5ebef;padding-top:17px;margin-top:17px}.table-wrap{overflow:auto}table{width:100%;border-collapse:collapse;font-size:13px}th,td{text-align:left;vertical-align:middle;padding:11px 8px;border-bottom:1px solid #e8edf0}th{font-size:11px;color:#637884}.actions{min-width:260px}.actions form{display:flex;gap:5px;align-items:center;margin:4px 0}.actions select{max-width:150px;padding:7px}.notice{padding:11px 13px;border-radius:8px;margin:10px 0;background:#eef5fb;color:#26516f;font-size:13px;overflow-wrap:anywhere}.notice.error{background:#fff0ee;color:#90372d}.notice.secret{background:#fff6dc;color:#704c00;font-family:ui-monospace,monospace}.login-page{min-height:100vh;display:grid;place-items:center;padding:20px;background:linear-gradient(145deg,#edf3f5,#e6edf3)}.login-card{width:min(100%,410px);padding:30px}.login-card h1{font-size:23px;margin:8px 0}.login-card form{display:grid;gap:12px;margin-top:22px}@media(max-width:760px){.layout{grid-template-columns:1fr;margin-top:16px}.wide{grid-column:auto}.topbar{padding:18px 20px}.setup-form{grid-template-columns:1fr}.tile-row{grid-template-columns:1fr}.actions{min-width:250px}}
.style-editor{margin-top:8px}.style-editor summary{cursor:pointer;color:#27618a;font-size:12px;font-weight:700;padding:5px 8px}.style-grid{display:grid!important;grid-template-columns:repeat(2,minmax(95px,1fr));gap:8px!important;background:#f5f8fa;padding:12px;border:1px solid #e5ecf0;border-radius:9px}.style-grid label{font-size:11px}.style-grid input[type=color]{height:35px;padding:3px}.style-grid select{padding:7px;font-size:12px}.style-grid button{grid-column:1/-1}
.style-grid .source-select,.style-grid .source-hint{grid-column:1/-1}.style-grid .source-hint{margin:0;font-size:11px;color:#657783}

    /* ============================================
       STYLE EDITOR (Inline)
       ============================================ */
    .style-editor {
        display: none;
        background: rgba(255, 255, 255, 0.98);
        border: 1px solid rgba(139, 92, 246, 0.3);
        border-radius: 16px;
        padding: 16px;
        margin-bottom: 12px;
        overflow: hidden;
        box-sizing: border-box;
    }
    .style-editor--visible {
        display: block;
    }
    .style-editor__header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;
        padding-bottom: 10px;
        border-bottom: 1px solid #f1f5f9;
    }
    .style-editor__title {
        font-size: 0.9rem;
        font-weight: 600;
        color: #0f172a;
        display: flex;
        align-items: center;
        gap: 6px;
    }
    .style-editor__title i {
        color: #8b5cf6;
    }
    .style-editor__close {
        background: none;
        border: none;
        color: #64748b;
        font-size: 1.2rem;
        cursor: pointer;
        padding: 4px;
        border-radius: 6px;
        transition: all 0.2s ease;
    }
    .style-editor__close:hover {
        background: #f1f5f9;
        color: #0f172a;
    }

    /* Base tile server picker */
    .style-editor__tile-server {
        margin-bottom: 16px;
    }
    .style-editor__select {
        width: 100%;
        padding: 8px 12px;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        font-size: 0.85rem;
        background: #fff;
        cursor: pointer;
        transition: border-color 0.2s ease;
    }
    .style-editor__select:focus {
        outline: none;
        border-color: #8b5cf6;
    }
    .style-editor__hint {
        margin: 6px 0 0 0;
        font-size: 0.72rem;
        color: #64748b;
    }

    /* Preset Grid */
    .style-editor__presets {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        margin-bottom: 16px;
    }
    .preset-btn {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        padding: 8px 10px;
        border: 2px solid #e2e8f0;
        border-radius: 8px;
        cursor: pointer;
        transition: all 0.2s ease;
        background: #fff;
        min-width: 50px;
    }
    .preset-btn:hover {
        border-color: #c4b5fd;
        background: rgba(139, 92, 246, 0.05);
    }
    .preset-btn--active {
        border-color: #8b5cf6;
        background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(139, 92, 246, 0.05) 100%);
    }
    .preset-btn__icon {
        width: 26px;
        height: 26px;
        border-radius: 6px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.85rem;
    }
    .preset-btn__icon--light { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); color: #d97706; }
    .preset-btn__icon--dark { background: linear-gradient(135deg, #1e293b 0%, #334155 100%); color: #fbbf24; }
    .preset-btn__icon--satellite { background: linear-gradient(135deg, #166534 0%, #15803d 100%); color: #fff; }
    .preset-btn__icon--contrast { background: linear-gradient(135deg, #fff 0%, #f1f5f9 100%); color: #0f172a; border: 1px solid #e2e8f0; }
    .preset-btn__icon--grayscale { background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%); color: #fff; }
    .preset-btn__name {
        font-size: 0.65rem;
        font-weight: 500;
        color: #475569;
    }

    /* Color Controls */
    .style-editor__colors {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
        margin-bottom: 16px;
    }
    @media (max-width: 768px) {
        .style-editor__colors {
            grid-template-columns: repeat(2, 1fr);
        }
    }
    @media (max-width: 480px) {
        .style-editor__colors {
            grid-template-columns: 1fr;
        }
    }
    .color-control {
        display: flex;
        flex-direction: column;
        gap: 4px;
        min-width: 0;
    }
    .color-control__label {
        font-size: 0.7rem;
        font-weight: 500;
        color: #64748b;
    }
    .color-control__input {
        display: flex;
        align-items: center;
        gap: 4px;
        min-width: 0;
    }
    .color-control__picker {
        width: 28px;
        height: 28px;
        min-width: 28px;
        border: 2px solid #e2e8f0;
        border-radius: 6px;
        cursor: pointer;
        padding: 0;
        flex-shrink: 0;
    }
    .color-control__picker::-webkit-color-swatch-wrapper { padding: 2px; }
    .color-control__picker::-webkit-color-swatch { border: none; border-radius: 3px; }
    .color-control__hex {
        flex: 1;
        min-width: 0;
        width: 100%;
        max-width: 80px;
        padding: 5px 6px;
        border: 1px solid #e2e8f0;
        border-radius: 6px;
        font-size: 0.7rem;
        font-family: monospace;
        text-transform: uppercase;
        box-sizing: border-box;
    }
    .color-control__hex:focus {
        outline: none;
        border-color: #8b5cf6;
    }

    /* Options Row */
    .style-editor__options {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 0;
        border-top: 1px solid #f1f5f9;
        border-bottom: 1px solid #f1f5f9;
        margin-bottom: 12px;
    }
    .style-editor__toggle-label {
        font-size: 0.8rem;
        color: #475569;
    }
    .toggle-sm {
        position: relative;
        width: 40px;
        height: 22px;
    }
    .toggle-sm input {
        opacity: 0;
        width: 0;
        height: 0;
    }
    .toggle-sm__slider {
        position: absolute;
        cursor: pointer;
        inset: 0;
        background-color: #cbd5e1;
        transition: 0.3s;
        border-radius: 22px;
    }
    .toggle-sm__slider:before {
        position: absolute;
        content: "";
        height: 16px;
        width: 16px;
        left: 3px;
        bottom: 3px;
        background-color: white;
        transition: 0.3s;
        border-radius: 50%;
    }
    input:checked + .toggle-sm__slider {
        background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
    }
    input:checked + .toggle-sm__slider:before {
        transform: translateX(18px);
    }

    /* Dark theme section */
    .style-editor__dark-section {
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid #f1f5f9;
    }
    .style-editor__dark-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 12px;
    }
    .style-editor__dark-toggle-label {
        font-size: 0.8rem;
        color: #475569;
        display: flex;
        align-items: center;
        gap: 6px;
    }
    .style-editor__dark-toggle-label i {
        color: #6366f1;
    }
    .style-editor__dark-content {
        display: none;
    }
    .style-editor__dark-content--visible {
        display: block;
    }
    .style-editor__dark-presets {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        margin-bottom: 12px;
    }
    .style-editor__section-label {
        font-size: 0.7rem;
        font-weight: 600;
        color: #6366f1;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-bottom: 8px;
    }

    /* Actions */
    .style-editor__actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    .style-editor__btn {
        flex: 1;
        min-width: 100px;
        padding: 8px 12px;
        border-radius: 8px;
        font-size: 0.8rem;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
    }
    .style-editor__btn--save {
        background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
        color: #fff;
        border: none;
    }
    .style-editor__btn--save:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
    }
    .style-editor__btn--save:disabled {
        opacity: 0.6;
        cursor: not-allowed;
        transform: none;
    }
    .style-editor__btn--cancel {
        background: #fff;
        color: #64748b;
        border: 1px solid #e2e8f0;
    }
    .style-editor__btn--cancel:hover {
        border-color: #cbd5e1;
        color: #475569;
    }
    .style-editor__btn--delete {
        background: #fff;
        color: #ef4444;
        border: 1px solid rgba(239, 68, 68, 0.3);
        flex: 0;
        padding: 10px 12px;
    }
    .style-editor__btn--delete:hover {
        background: rgba(239, 68, 68, 0.05);
        border-color: rgba(239, 68, 68, 0.5);
    }
    .style-editor__btn--upgrade {
        background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
        color: #fff;
        border: none;
    }
    .style-editor__btn--upgrade:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    }


/* Local admin uses the portal customizer in a two-column panel. */
.local-customizer-layout{display:grid;grid-template-columns:minmax(320px,1fr) minmax(360px,1.15fr);gap:18px;align-items:start}
.local-customizer-map{min-height:560px}
.local-customizer-map .tile-map-container{height:540px;min-height:540px}
.local-customizer-map #local-style-map{width:100%;height:100%;min-height:540px;border-radius:16px}
.local-customizer-map .maplibregl-map{font:12px/20px Arial,sans-serif}
.local-customizer-notice{margin:10px 0;color:#245d42;font-size:13px}
@media(max-width:900px){.local-customizer-layout{grid-template-columns:1fr}.local-customizer-map .tile-map-container,.local-customizer-map #local-style-map{height:380px;min-height:380px}}

    .tile-map-column {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-width: 0;
    }
    .tile-map-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 16px;
    }
    .tile-map-header h5 {
        margin: 0;
        font-size: 1rem;
        font-weight: 600;
        color: #0f172a;
        display: flex;
        align-items: center;
        gap: 8px;
    }
    .tile-map-header h5 i {
        color: #64748b;
    }
    .tile-map-controls {
        display: flex;
        gap: 8px;
    }
    .tile-map-control {
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #fff;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        color: #64748b;
        cursor: pointer;
        transition: all 0.2s ease;
    }
    .tile-map-control:hover {
        border-color: #2563eb;
        color: #2563eb;
        box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
    }
    .tile-map-control--active {
        background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
        border-color: transparent;
        color: #fff;
    }
    .tile-map-container {
        flex: 1;
        position: relative;
        background: #f8fafc;
        border-radius: 16px;
        overflow: hidden;
        box-shadow:
            0 4px 24px rgba(15, 23, 42, 0.08),
            0 2px 8px rgba(15, 23, 42, 0.04);
        min-height: 450px;
    }
    #map {
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
    }
    .tile-map-info {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-top: 12px;
        padding: 10px 16px;
        background: rgba(255, 255, 255, 0.9);
        border-radius: 10px;
        font-size: 0.85rem;
        color: #475569;
    }
    .tile-map-mode {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        color: #6366f1;
        font-weight: 500;
    }
    #local-style-map { width: 100%; height: 100%; position: absolute; inset: 0; }
