*{box-sizing:border-box}
:root{
  --bg:#f4f6f8;--panel:#fff;--border:#dfe4ea;--text:#1f2933;
  --muted:#667085;--soft:#f8fafc;--shadow:0 10px 30px rgba(16,24,40,.08)
}
html,body{margin:0;width:100%;height:100%;font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:var(--text);background:var(--bg)}
body{overflow:hidden}
.topbar{height:68px;display:flex;align-items:center;justify-content:space-between;gap:20px;padding:0 22px;background:#fff;border-bottom:1px solid var(--border);position:relative;z-index:1000}
.brand-title{font-size:18px;font-weight:700;letter-spacing:-.01em}
.brand-subtitle{margin-top:2px;font-size:12px;color:var(--muted)}
.topbar-status{display:flex;align-items:center;gap:8px;color:var(--muted);font-size:13px}
.status-dot{width:8px;height:8px;border-radius:50%;background:#43a047}
.page{height:calc(100vh - 68px);display:grid;grid-template-columns:minmax(0,1fr) 330px;gap:16px;padding:16px}
.map-shell{min-width:0;position:relative;overflow:hidden;border:1px solid var(--border);border-radius:16px;background:#fff;box-shadow:var(--shadow)}
#map{width:100%;height:100%;background:#eef2f6}
.map-hint{position:absolute;left:18px;bottom:18px;z-index:500;max-width:410px;padding:11px 14px;border-radius:10px;border:1px solid rgba(208,213,221,.95);background:rgba(255,255,255,.94);box-shadow:0 4px 18px rgba(16,24,40,.08);font-size:13px;line-height:1.45;backdrop-filter:blur(6px)}
.info-panel{overflow:auto;padding:22px;border:1px solid var(--border);border-radius:16px;background:var(--panel);box-shadow:var(--shadow)}
.info-panel h1{margin:0 0 10px;font-size:22px;line-height:1.2}
.lead{margin:0 0 20px;color:var(--muted);font-size:14px;line-height:1.55}
.basemap-card{margin-bottom:12px;padding:15px;background:var(--soft);border:1px solid var(--border);border-radius:12px}
.basemap-card__title{margin-bottom:6px;font-size:14px;font-weight:700}
.basemap-card__text{color:var(--muted);font-size:13px;line-height:1.5}
.next-step{margin-top:22px;padding-top:18px;border-top:1px solid var(--border)}
.next-step__label{margin-bottom:6px;color:var(--muted);font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.08em}
.next-step__text{font-size:13px;line-height:1.5}
.leaflet-control-layers{border:1px solid #d0d5dd!important;border-radius:10px!important;box-shadow:0 4px 16px rgba(16,24,40,.08)!important}
.leaflet-control-layers-expanded{padding:10px 12px!important;color:var(--text);background:rgba(255,255,255,.98)!important}
.leaflet-control-zoom a{color:#344054!important;background:#fff!important}
@media(max-width:900px){
 body{overflow:auto}.page{height:auto;min-height:calc(100vh - 68px);grid-template-columns:1fr}
 .map-shell{min-height:65vh}.info-panel{min-height:auto}
}
@media(max-width:560px){
 .topbar{height:62px;padding:0 14px}.topbar-status{display:none}.page{padding:10px;gap:10px}
 .map-shell,.info-panel{border-radius:12px}.map-hint{left:10px;right:10px;bottom:10px;max-width:none}
}

.tool-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:16px}
.tool-button{appearance:none;border:1px solid #cfd6de;border-radius:10px;background:#fff;color:#24313d;padding:11px 12px;font:inherit;font-size:13px;font-weight:700;cursor:pointer;transition:background .15s ease,border-color .15s ease,transform .05s ease}
.tool-button:hover:not(:disabled){background:#f7f9fb;border-color:#aeb8c4}
.tool-button:active:not(:disabled){transform:translateY(1px)}
.tool-button:disabled{cursor:not-allowed;opacity:.5}
.tool-button--secondary{grid-column:1 / -1;color:#667085}
.tool-button.is-active{background:#eef4ff;border-color:#8ea9d1}
.metrics-card,.limits-card{margin-bottom:12px;padding:15px;border:1px solid var(--border);border-radius:12px;background:#fff}
.metrics-card__title,.limits-card__title{margin-bottom:10px;font-size:14px;font-weight:700}
.metric-row{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:7px 0;border-bottom:1px solid #edf0f3;color:var(--muted);font-size:13px}
.metric-row strong{color:var(--text);font-weight:700}
.metric-row:last-of-type{border-bottom:0}
.validation-status{margin-top:12px;padding:10px 11px;border-radius:9px;font-size:12px;line-height:1.4;font-weight:700}
.validation-status--neutral{background:#f5f7fa;color:#667085}
.validation-status--ok{background:#eef8f0;color:#26703a}
.validation-status--bad{background:#fff1f0;color:#a93a32}
.limits-card__text{color:var(--muted);font-size:12px;line-height:1.45}
.aoi-popup{min-width:190px;font-size:12px;line-height:1.5}
.processing-card{background:#fbfcfe}
.tile-status{margin-top:12px;padding:10px 11px;border-radius:9px;font-size:12px;line-height:1.4;font-weight:700}
.tile-status--neutral{background:#f5f7fa;color:#667085}
.tile-status--ok{background:#fff7e8;color:#8a5415}
.tile-status--perfect{background:#eef8f0;color:#26703a}
.legend-card{margin-bottom:12px;padding:13px 15px;border:1px solid var(--border);border-radius:12px;background:#fff}
.legend-row{display:flex;align-items:center;gap:9px;padding:4px 0;color:var(--muted);font-size:12px}
.legend-swatch{width:22px;height:10px;border-radius:3px;flex:0 0 auto}
.legend-swatch--aoi{border:2px solid #275d9b;background:rgba(111,159,212,.18)}
.legend-swatch--tile{border:2px solid #d47718;background:rgba(245,166,35,.16)}
.legend-swatch--grid{border:1px dashed #8e98a6;background:rgba(142,152,166,.06)}
.tile-label{color:#8a5415;font-weight:700;font-size:11px;white-space:nowrap;text-shadow:-1px -1px 0 rgba(255,255,255,.9),1px -1px 0 rgba(255,255,255,.9),-1px 1px 0 rgba(255,255,255,.9),1px 1px 0 rgba(255,255,255,.9)}
.viewer-card{margin-bottom:12px;padding:15px;border:1px solid var(--border);border-radius:12px;background:#fff}
.viewer-card__title{margin-bottom:6px;font-size:14px;font-weight:700}
.viewer-card__text{margin-bottom:12px;color:var(--muted);font-size:12px;line-height:1.45}
.gpkg-dropzone{min-height:92px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;margin-bottom:12px;padding:14px;border:2px dashed #b9c3cf;border-radius:10px;background:#f8fafc;cursor:pointer;text-align:center;transition:background .15s ease,border-color .15s ease}
.gpkg-dropzone:hover,.gpkg-dropzone.is-dragover{background:#eef4ff;border-color:#7898c2}
.gpkg-dropzone__main{color:#344054;font-size:13px;font-weight:700}
.gpkg-dropzone__sub{color:#7b8794;font-size:11px}
.viewer-metrics{margin-bottom:10px}
.viewer-status{margin-top:10px;padding:10px 11px;border-radius:9px;font-size:12px;line-height:1.4;font-weight:700}
.viewer-status--neutral{background:#f5f7fa;color:#667085}
.viewer-status--loading{background:#eef4ff;color:#315e91}
.viewer-status--ok{background:#eef8f0;color:#26703a}
.viewer-status--bad{background:#fff1f0;color:#a93a32}
.viewer-clear{width:100%;margin-top:10px}
.result-popup{max-width:360px;font-size:12px;line-height:1.45}
.result-popup__address{margin-bottom:7px;font-weight:700}
.result-popup__number{color:#667085}

/* ===== v4.1: visible GPKG drop zone + full-page drag overlay ===== */
.viewer-card{overflow:visible}
.gpkg-dropzone{position:relative;box-sizing:border-box;width:100%;min-height:112px !important;display:flex !important;flex-direction:column;align-items:center;justify-content:center;gap:5px;margin:12px 0 14px 0;padding:18px 14px;border:2px dashed #8fa0b4 !important;border-radius:12px;background:#f7f9fc !important;cursor:pointer;text-align:center;user-select:none;visibility:visible !important;opacity:1 !important}
.gpkg-dropzone:hover,.gpkg-dropzone:focus,.gpkg-dropzone.is-dragover{outline:none;border-color:#557aa8 !important;background:#edf4ff !important}
.gpkg-dropzone__icon{display:inline-flex;align-items:center;justify-content:center;min-width:48px;height:28px;padding:0 9px;border:1px solid #9ba9b8;border-radius:7px;background:#fff;color:#435267;font-size:11px;font-weight:800;letter-spacing:.05em}
.gpkg-dropzone__main{color:#263445 !important;font-size:13px;font-weight:800}
.gpkg-dropzone__sub{color:#667085 !important;font-size:11px}
.global-gpkg-overlay{position:fixed;inset:0;z-index:99999;display:none;align-items:center;justify-content:center;padding:24px;background:rgba(238,244,252,.72);backdrop-filter:blur(2px);pointer-events:none}
.global-gpkg-overlay.is-visible{display:flex}
.global-gpkg-overlay__panel{width:min(560px, calc(100vw - 48px));padding:30px 26px;border:3px dashed #557aa8;border-radius:18px;background:rgba(255,255,255,.96);box-shadow:0 18px 50px rgba(31,41,55,.18);text-align:center}
.global-gpkg-overlay__title{margin-bottom:7px;color:#24313d;font-size:20px;font-weight:800}
.global-gpkg-overlay__subtitle{color:#667085;font-size:13px}
body.is-file-dragging{overflow:hidden}

/* ===== v4.3: GPKG type styling + address-number labels ===== */
.address-number-icon{background:transparent;border:0}
.address-number-label{display:inline-block;padding:0 2px;font-size:10px;line-height:1.1;font-weight:700;white-space:nowrap;background:rgba(255,255,255,.78);border-radius:3px;text-shadow:-1px -1px 0 rgba(255,255,255,.9),1px -1px 0 rgba(255,255,255,.9),-1px 1px 0 rgba(255,255,255,.9),1px 1px 0 rgba(255,255,255,.9)}
.address-number-label--building{color:#2f6db3}
.address-number-label--land_parcel{color:#b84b4b}
.address-number-label--unknown{color:#6b7280}
.viewer-type-legend{display:flex;flex-wrap:wrap;gap:10px 14px;margin-top:10px;padding-top:10px;border-top:1px solid #edf0f3;color:#667085;font-size:11px}
.viewer-type-legend__item{display:flex;align-items:center;gap:6px}
.viewer-type-legend__dot{width:8px;height:8px;border-radius:50%}
.viewer-type-legend__dot--building{background:#4f8ed8;border:1px solid #2f6db3}
.viewer-type-legend__dot--parcel{background:#d95f5f;border:1px solid #b84b4b}

/* ===== v5: simple Photon geocoder ===== */
.map-search{position:absolute;z-index:1000;top:18px;left:62px;width:min(520px, calc(100% - 360px))}
.map-search__row{display:flex;gap:8px}
.map-search__input{flex:1 1 auto;min-width:0;height:42px;padding:0 13px;border:1px solid #cfd6de;border-radius:10px;background:rgba(255,255,255,.97);box-shadow:0 2px 8px rgba(31,41,55,.12);color:#24313d;font:inherit;font-size:13px;outline:none}
.map-search__input:focus{border-color:#7d9bc2;box-shadow:0 0 0 3px rgba(92,126,170,.12),0 2px 8px rgba(31,41,55,.12)}
.map-search__button{flex:0 0 auto;height:42px;padding:0 15px;border:1px solid #b8c3cf;border-radius:10px;background:#fff;color:#2b3a4a;font:inherit;font-size:13px;font-weight:700;cursor:pointer;box-shadow:0 2px 8px rgba(31,41,55,.10)}
.map-search__button:hover{background:#f7f9fb}
.map-search__button:disabled{opacity:.55;cursor:not-allowed}
.map-search__results{margin-top:7px;max-height:300px;overflow:auto;border:1px solid #d5dbe2;border-radius:10px;background:#fff;box-shadow:0 8px 24px rgba(31,41,55,.16)}
.map-search__result{display:block;width:100%;padding:10px 12px;border:0;border-bottom:1px solid #edf0f3;background:#fff;text-align:left;cursor:pointer;color:#24313d;font:inherit}
.map-search__result:last-child{border-bottom:0}
.map-search__result:hover,.map-search__result:focus{background:#f6f8fb;outline:none}
.map-search__result-name{display:block;margin-bottom:2px;font-size:13px;font-weight:700}
.map-search__result-context{display:block;color:#667085;font-size:11px;line-height:1.35}
.map-search__message{padding:11px 12px;color:#667085;font-size:12px}
.search-marker{background:transparent;border:0}
.search-marker__dot{width:14px;height:14px;border-radius:50%;border:3px solid #fff;background:#3b6ea8;box-shadow:0 1px 5px rgba(0,0,0,.28)}
@media (max-width:900px){.map-search{left:12px;right:12px;width:auto;top:12px}.map-search__button{padding:0 12px}}

/* ===== v5.2: address hierarchy selector ===== */
.hierarchy-card{margin-bottom:12px;padding:15px;border:1px solid var(--border);border-radius:12px;background:#fff}
.hierarchy-card__title{margin-bottom:4px;font-size:14px;font-weight:700}
.hierarchy-card__text{margin-bottom:11px;color:var(--muted);font-size:12px;line-height:1.45}
.hierarchy-option{display:flex;align-items:flex-start;gap:9px;margin:0;padding:10px 0;border-bottom:1px solid #edf0f3;cursor:pointer}
.hierarchy-option:last-of-type{border-bottom:0}
.hierarchy-option input[type="radio"]{margin:3px 0 0 0;flex:0 0 auto;accent-color:#315e91}
.hierarchy-option__content{display:flex;flex-direction:column;gap:2px;min-width:0}
.hierarchy-option__name{color:#24313d;font-size:13px;font-weight:700}
.hierarchy-option__hint{color:#7b8794;font-size:11px;line-height:1.35}
.hierarchy-option--disabled{cursor:not-allowed;opacity:.55}
.hierarchy-badge{display:inline-block;margin-left:6px;padding:2px 6px;border-radius:999px;background:#f0f2f5;color:#667085;font-size:10px;font-weight:700;vertical-align:1px}
.hierarchy-current{margin-top:10px;padding-top:10px;border-top:1px solid #edf0f3;color:#667085;font-size:11px}
.hierarchy-current strong{color:#24313d}

/* ===== Local backend job workflow ===== */
.job-card{margin-bottom:12px;padding:15px;border:1px solid var(--border);border-radius:12px;background:#fff}
.job-card__title{margin-bottom:4px;font-size:14px;font-weight:700}
.job-card__text{margin-bottom:12px;color:var(--muted);font-size:12px;line-height:1.45}
.submit-job-button{width:100%;min-height:42px;border:1px solid #315e91;border-radius:10px;background:#315e91;color:#fff;font:inherit;font-size:13px;font-weight:800;cursor:pointer}
.submit-job-button:hover:not(:disabled){background:#294f7a}
.submit-job-button:disabled{cursor:not-allowed;opacity:.48}
.job-status{margin-top:10px;padding:10px 11px;border-radius:9px;font-size:12px;line-height:1.4;font-weight:700}
.job-status--neutral{background:#f5f7fa;color:#667085}
.job-status--queued{background:#fff7e8;color:#8a5415}
.job-status--processing{background:#eef4ff;color:#315e91}
.job-status--completed{background:#eef8f0;color:#26703a}
.job-status--failed{background:#fff1f0;color:#a93a32}
.job-details{margin-top:8px}
.download-result{display:block;margin-top:10px;padding:10px 12px;border-radius:9px;background:#eef8f0;color:#26703a;font-size:12px;font-weight:800;text-align:center;text-decoration:none}
.download-result:hover{text-decoration:underline}

/* ===== v6: registration + email verification ===== */
.auth-card{margin-bottom:12px;padding:15px;border:1px solid var(--border);border-radius:12px;background:#fff}
.auth-card__title{margin-bottom:4px;font-size:14px;font-weight:700}
.auth-card__text{margin-bottom:12px;color:var(--muted);font-size:12px;line-height:1.45}
.auth-card__text code{font-size:11px}
.auth-label{display:block;margin:7px 0 5px;color:#475467;font-size:11px;font-weight:700}
.auth-row{display:flex;gap:8px;align-items:center}
.auth-input{min-width:0;flex:1 1 auto;height:40px;box-sizing:border-box;padding:0 10px;border:1px solid #cfd6de;border-radius:9px;background:#fff;color:#24313d;font:inherit;font-size:13px;outline:none}
.auth-input:focus{border-color:#7d9bc2;box-shadow:0 0 0 3px rgba(92,126,170,.12)}
.auth-input--code{letter-spacing:.18em;font-weight:800}
.auth-button{flex:0 0 auto;min-height:40px;padding:0 12px;border:1px solid #315e91;border-radius:9px;background:#315e91;color:#fff;font:inherit;font-size:12px;font-weight:800;cursor:pointer}
.auth-button:hover:not(:disabled){background:#294f7a}
.auth-button:disabled{opacity:.5;cursor:not-allowed}
.auth-button--secondary{width:100%;margin-top:10px;border-color:#cfd6de;background:#fff;color:#475467}
.auth-button--secondary:hover:not(:disabled){background:#f7f9fb}
.auth-code-row{margin-top:8px}
.auth-status{margin-top:10px;padding:10px 11px;border-radius:9px;font-size:12px;line-height:1.4;font-weight:700}
.auth-status--neutral{background:#f5f7fa;color:#667085}.auth-status--loading{background:#eef4ff;color:#315e91}.auth-status--ok{background:#eef8f0;color:#26703a}.auth-status--bad{background:#fff1f0;color:#a93a32}
.auth-logged-in{padding:10px 0 0}
.auth-user-line{display:flex;justify-content:space-between;gap:12px;padding:5px 0;border-bottom:1px solid #edf0f3;color:#667085;font-size:12px}
.auth-user-line strong{color:#24313d;text-align:right;overflow-wrap:anywhere}
@media (max-width:520px){.auth-row{align-items:stretch;flex-direction:column}.auth-button{width:100%}}

/* ===== Final beta UI pass ===== */
.auth-required-message{margin:0 0 12px 0;color:#b42318;font-size:12px;font-weight:800;line-height:1.4}
.auth-user-line--credits strong{color:#24313d}
.credits-contact-link{display:inline-block;margin:6px 0 10px 0;color:#315e91;font-size:11px;font-weight:700;text-decoration:none}
.credits-contact-link:hover{text-decoration:underline}
.workflow-section{margin-bottom:12px;padding:15px;border:1px solid var(--border);border-radius:12px;background:#fff}
.workflow-section h1{margin-top:0}
.feedback-card{margin-bottom:12px;padding:15px;border:1px solid var(--border);border-radius:12px;background:#fff}
.feedback-card__title{margin-bottom:5px;font-size:14px;font-weight:700}
.feedback-card__text{margin-bottom:11px;color:var(--muted);font-size:12px;line-height:1.45}
.feedback-actions{display:flex;gap:8px;flex-wrap:wrap}
.feedback-actions a{display:inline-flex;align-items:center;justify-content:center;min-height:34px;padding:0 11px;border:1px solid #cfd6de;border-radius:9px;background:#fff;color:#315e91;font-size:12px;font-weight:700;text-decoration:none}
.feedback-actions a:hover{background:#f7f9fb;border-color:#aeb8c4}
.map-hint{max-width:390px}

/* ===== v4 pre-deploy: long-running job UX / account privacy / job history ===== */
.processing-live{margin-top:12px;padding:16px;display:flex;gap:14px;align-items:flex-start;border:2px solid #6f91bc;border-radius:12px;background:#edf4ff}
.processing-live__spinner{width:28px;height:28px;flex:0 0 auto;margin-top:1px;border:4px solid rgba(49,94,145,.18);border-top-color:#315e91;border-radius:50%;animation:processing-spin .9s linear infinite}
@keyframes processing-spin{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion:reduce){.processing-live__spinner{animation:none}}
.processing-live__content{min-width:0}.processing-live__title{color:#244d7d;font-size:14px;font-weight:800}.processing-live__elapsed{margin-top:5px;color:#315e91;font-size:13px}.processing-live__message{margin-top:8px;color:#4b6179;font-size:12px;line-height:1.45}
.privacy-notice{margin-top:11px;padding-top:10px;border-top:1px solid #edf0f3;color:#7b8794;font-size:10.5px;line-height:1.45}
.privacy-delete-button{display:block;margin-top:7px;padding:0;border:0;background:transparent;color:#a43c3c;font:inherit;font-size:10.5px;text-decoration:underline;cursor:pointer}
.my-jobs-card{margin-bottom:12px;padding:15px;border:1px solid var(--border);border-radius:12px;background:#fff}
.my-jobs-card__title{margin-bottom:4px;font-size:14px;font-weight:700}
.my-jobs-card__text{margin-bottom:10px;color:var(--muted);font-size:11px;line-height:1.4}
.my-jobs-list{display:flex;flex-direction:column;gap:7px}
.my-job-item{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:center;padding:9px 10px;border:1px solid #e4e8ed;border-radius:9px;background:#fafbfc}
.my-job-item__main{min-width:0}.my-job-item__id{font-size:11px;font-weight:800;color:#344054}.my-job-item__meta{margin-top:2px;font-size:10.5px;color:#7b8794}.my-job-item__action{min-height:30px;padding:5px 8px;border:1px solid #b8c3cf;border-radius:7px;background:#fff;color:#344054;font:inherit;font-size:10.5px;font-weight:700;cursor:pointer}
.processing-live[hidden],.auth-status[hidden],#auth-code-row[hidden],#auth-logged-in[hidden],#auth-logged-out[hidden],#my-jobs-card[hidden],#download-result[hidden],#job-details[hidden]{display:none !important}
