/* SharpGIS — calm, map-first styles (Milestone 2b). One token set, one button style, one panel style. */
:root {
  --ink: #13293d;
  --text: #4a5b6b;
  --muted: #84939f;
  --line: #e3e9ef;
  --bg: #f5f8fb;
  --card: #ffffff;
  --primary: #2477b3;
  --primary-hover: #1f6aa0;
  --accent: #3498db;
  --mint: #eaf4fc;
  --amber: #ffb627;
  --danger: #b5462a;
  --radius: 12px;
  --shadow: 0 8px 28px rgba(19, 41, 61, .14), 0 0 0 1px rgba(19, 41, 61, .05);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 14px/1.5 "DM Sans", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: Manrope, "DM Sans", sans-serif; letter-spacing: -.3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.spacer { flex: 1; }

/* Buttons (.button* kept as aliases for the dialogs) */
.btn, .button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 40px; padding: 0 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); font-weight: 600; font-size: 14px; white-space: nowrap; text-decoration: none; }
.btn:hover, .button:hover { border-color: #c4d4e2; }
.btn-primary, .button-primary { border-color: var(--primary); background: var(--primary); color: #fff; }
.btn-primary:hover, .button-primary:hover { border-color: var(--primary-hover); background: var(--primary-hover); }
.btn-small, .button-small { height: 34px; padding: 0 13px; border-radius: 8px; font-size: 13px; }
.btn-large { height: 48px; padding: 0 22px; font-size: 15px; }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: var(--card); color: var(--text); font-size: 16px; line-height: 1; }
.icon-btn:hover { color: var(--ink); border-color: #c4d4e2; }
.icon-btn.small { width: 26px; height: 26px; border-radius: 7px; font-size: 14px; }

/* Brand */
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font: 800 19px Manrope, sans-serif; letter-spacing: -.3px; text-decoration: none; white-space: nowrap; }
.brand b { color: var(--accent); font-weight: 800; }

/* Stages */
.stage { min-height: 100vh; }
.site-bar { height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 clamp(16px, 4vw, 56px); }
.site-actions { display: flex; align-items: center; gap: 10px; }

/* Landing */
.landing { display: flex; flex-direction: column; }
.landing-main { flex: 1; width: min(1120px, 100%); margin: 0 auto; padding: clamp(28px, 6vh, 72px) clamp(16px, 4vw, 56px) 40px; }
.hero { max-width: 760px; }
.kicker { display: inline-flex; padding: 6px 12px; border-radius: 20px; background: var(--mint); color: var(--primary); font-size: 13px; font-weight: 600; }
.hero h1 { margin: 18px 0 16px; font-size: clamp(36px, 5.4vw, 58px); line-height: 1.06; font-weight: 800; letter-spacing: -1.5px; }
.hero h1 em { color: var(--accent); font-style: normal; }
.lede { margin: 0 0 28px; color: var(--text); font-size: 18px; line-height: 1.6; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.formats { margin: 22px 0 0; color: var(--muted); font-size: 13px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: clamp(40px, 8vh, 80px); }
.step { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.step b { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; font: 700 15px Manrope, sans-serif; }
.step b i { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; background: var(--mint); color: var(--primary); font-style: normal; font-size: 13px; }
.step span { color: var(--text); font-size: 14px; }
.site-footer { padding: 20px clamp(16px, 4vw, 56px); color: var(--muted); font-size: 12px; }

/* Picker */
.picker { background: var(--bg); }
.picker .site-bar { background: var(--card); border-bottom: 1px solid var(--line); }
.picker-main { width: min(1200px, 100%); margin: 0 auto; padding: 32px clamp(16px, 4vw, 56px) 48px; }
.picker-main h1 { margin: 0 0 4px; font-size: 28px; font-weight: 800; }
.picker-sub { margin: 0 0 22px; color: var(--text); }
.picker-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.picker-count { margin-right: auto; color: var(--muted); font-size: 13px; }
.search-box { height: 40px; width: min(320px, 100%); display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--muted); }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
.search-box.small { height: 32px; width: 220px; border-radius: 8px; }
.picker-empty { margin: 18px 0 0; color: var(--muted); }
.picker-unavailable { margin: 18px 0; padding: 22px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid #f0d2bd; border-radius: var(--radius); background: #fff8f2; color: #6b3a17; }

/* Workspace */
.workspace { height: 100vh; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.ws-bar { height: 56px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 14px; border-bottom: 1px solid var(--line); background: var(--card); z-index: 5; }
.ws-title { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.ws-title strong { font: 700 15px Manrope, sans-serif; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-title small { color: var(--muted); font-size: 12px; }
.map-canvas { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #e8ede6; }
.map-view { position: absolute; inset: 0; z-index: 0; }
.map-view .maplibregl-canvas { outline: none; }
.map-canvas .maplibregl-ctrl-bottom-left { left: 64px; }
.map-canvas .maplibregl-ctrl-scale { border-color: #334352; color: #334352; background: rgba(255, 255, 255, .85); font-size: 10px; }
.map-canvas .maplibregl-ctrl-attrib { font-size: 10px; }

/* Floating panels */
.panel { background: rgba(255, 255, 255, .98); border-radius: 14px; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 12px 8px 16px; }
.panel-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; }
.panel-head .count { min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--bg); color: var(--muted); font-size: 11px; text-align: center; }
.panel-body { padding: 0 12px 12px; }
.panel.collapsed .panel-body { display: none; }
.panel-note { margin: 0 4px 8px; color: var(--muted); font-size: 12.5px; }
#layersPanel { display: flex; flex-direction: column; min-height: 0; }
#layersPanel .panel-body { min-height: 0; overflow: auto; }
.layer-list { max-height: 46vh; overflow: auto; }
.layer-empty { margin: 4px 4px 8px; color: var(--muted); font-size: 13px; }
.add-row { width: 100%; margin-top: 6px; padding: 9px; border: 1.5px dashed #c4d4e2; border-radius: 9px; background: transparent; color: var(--primary); font-weight: 600; font-size: 13px; }
.add-row:hover { background: var(--mint); }

/* Layer rows */
.layer-row { position: relative; display: flex; align-items: center; gap: 9px; padding: 8px 6px; border-radius: 9px; cursor: pointer; }
.layer-row:hover { background: var(--bg); }
.layer-row.selected-layer { background: var(--mint); }
.layer-row.is-reordering { opacity: .5; }
.layer-row.search-hidden { display: none; }
.layer-reorder { color: #b4bec0; font-size: 13px; cursor: grab; }
.layer-toggle { position: relative; width: 16px; height: 16px; flex: none; cursor: pointer; }
.layer-toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.layer-toggle > span { position: absolute; inset: 0; border: 1.5px solid #bec9c8; border-radius: 4px; background: #fff; }
.layer-toggle input:checked + span { border-color: var(--primary); background: var(--primary); }
.layer-toggle input:checked + span::after { content: ""; position: absolute; left: 4px; top: 4px; width: 6px; height: 3px; transform: rotate(-45deg); border-bottom: 1.6px solid #fff; border-left: 1.6px solid #fff; }
.layer-toggle input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.layer-symbol { --symbol-color: #9aa7a3; width: 16px; height: 16px; flex: none; border: 1.5px solid var(--symbol-color); border-radius: 4px; background: color-mix(in srgb, var(--symbol-color) 45%, transparent); }
.layer-symbol.symbol-line { height: 4px; border: 0; border-radius: 2px; background: var(--symbol-color); }
.layer-symbol.symbol-point { width: 11px; height: 11px; margin: 0 2.5px; border: 1.5px solid #fff; border-radius: 50%; background: var(--symbol-color); box-shadow: 0 0 0 1px var(--symbol-color); }
.layer-symbol.symbol-raster { border: 0; background: linear-gradient(135deg, #f7fcf0, #4eb3d3 55%, #084081); }
.layer-label { flex: 1; min-width: 0; display: grid; gap: 1px; }
.layer-label strong { overflow: hidden; color: var(--ink); font-size: 13.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.layer-label small { color: var(--muted); font-size: 11.5px; }
.layer-row.layer-hidden .layer-label { opacity: .5; }
.layer-row.layer-error .layer-label small { color: var(--danger); white-space: normal; line-height: 1.35; }
.layer-row.layer-loading .layer-label small { font-style: italic; }
.fix-location-button { justify-self: start; margin-top: 3px; padding: 3px 8px; border: 1px solid #f0c7a8; border-radius: 6px; background: #fff6ef; color: #9a4a1c; font-size: 11px; font-weight: 700; }

/* Tools */
.tool-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.tool-list button { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 0 8px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; text-align: left; }
.tool-list b { font-size: 13px; }
.tool-list small { grid-column: 1; color: var(--muted); font-size: 11.5px; }
.tool-list em { grid-row: 1 / span 2; grid-column: 2; align-self: center; padding: 2px 7px; border-radius: 10px; background: var(--bg); color: var(--muted); font-size: 10.5px; font-style: normal; }
.tool-list button:disabled { opacity: .75; }

/* Layer options */
.layer-options { position: absolute; z-index: 5; left: 316px; top: 14px; width: 260px; max-height: calc(100% - 28px); overflow: auto; }
.opt-row { display: grid; gap: 6px; margin: 4px 4px 12px; color: var(--text); font-size: 12.5px; }
.opt-row output { color: var(--ink); font-weight: 600; }
.opt-row input[type="range"] { width: 100%; accent-color: var(--primary); }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.swatches button { width: 22px; height: 22px; padding: 0; border: 0; border-radius: 6px; }
.swatches button[aria-pressed="true"] { outline: 2px solid var(--ink); outline-offset: 2px; }
.swatches input[type="color"] { width: 26px; height: 24px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: var(--bg); }
.segmented button { padding: 5px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text); font-size: 12px; }
.segmented button[aria-checked="true"] { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.opt-actions { display: grid; gap: 2px; padding-top: 8px; border-top: 1px solid var(--line); }
.opt-actions button { padding: 8px 6px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font-size: 13px; text-align: left; }
.opt-actions button:hover { background: var(--bg); }
.opt-actions button.danger { color: var(--danger); }

/* Map controls */
.basemap-switch { position: absolute; z-index: 3; left: 50%; top: 14px; transform: translateX(-50%); display: flex; gap: 2px; padding: 4px; border-radius: 11px; background: #fff; box-shadow: var(--shadow); }
.basemap-switch button { padding: 6px 13px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font-size: 13px; }
.basemap-switch button[aria-pressed="true"] { background: var(--ink); color: #fff; font-weight: 600; }
.zoom-controls { position: absolute; z-index: 3; left: 14px; bottom: 22px; display: grid; padding: 4px; border-radius: 11px; background: #fff; box-shadow: var(--shadow); }
.zoom-controls button { width: 34px; height: 32px; border: 0; border-radius: 7px; background: transparent; color: var(--text); font-size: 17px; }
.zoom-controls button:hover { background: var(--bg); }
.zoom-indicator { position: absolute; z-index: 3; left: 60px; bottom: 100px; padding: 3px 7px; border-radius: 6px; background: rgba(19, 41, 61, .75); color: #fff; font-size: 11px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.zoom-indicator.show { opacity: 1; }
.map-legend { position: absolute; z-index: 3; right: 400px; bottom: 34px; max-width: 220px; max-height: 40%; overflow: hidden; padding: 10px 12px; display: grid; gap: 5px; border-radius: 12px; background: #fff; box-shadow: var(--shadow); color: var(--text); font-size: 12px; }
.map-legend strong { color: var(--ink); font-size: 12px; }
.map-legend > span { display: flex; align-items: center; gap: 7px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.legend-swatch { width: 12px; height: 12px; flex: none; border-radius: 3px; }
.legend-swatch.legend-line { height: 3px; border-radius: 2px; }
.legend-swatch.legend-point { border-radius: 50%; }
.legend-swatch.legend-raster { background: linear-gradient(135deg, #f7fcf0, #4eb3d3 55%, #084081); }

/* Attribute table */
.attr-table { position: absolute; z-index: 4; left: 14px; right: 390px; bottom: 14px; height: 38%; min-height: 160px; display: flex; flex-direction: column; border-radius: 14px; background: #fff; box-shadow: var(--shadow); resize: vertical; overflow: hidden; }
.attr-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line); }
.attr-head strong { font-family: Manrope, sans-serif; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attr-note { margin-right: auto; color: var(--muted); font-size: 12px; }
.attr-scroll { flex: 1; overflow: auto; }
.attr-table table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.attr-table th { position: sticky; top: 0; padding: 7px 10px; background: var(--bg); color: var(--text); font-weight: 600; text-align: left; white-space: nowrap; }
.attr-table td { max-width: 260px; padding: 6px 10px; border-top: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attr-table tbody tr { cursor: pointer; }
.attr-table tbody tr:hover { background: var(--mint); }
.attr-table tbody tr.search-hidden { display: none; }

/* Assistant */
.assistant-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.assistant-content { flex: 1; min-height: 0; overflow: auto; padding: 2px 4px; }
.assistant-bubble, .assistant-message { margin-bottom: 10px; padding: 11px 13px; border-radius: 12px; background: var(--bg); color: var(--text); font-size: 13.5px; }
.assistant-message.user-message { margin-left: 40px; background: var(--mint); color: var(--ink); }
.assistant-message strong { display: block; margin-bottom: 4px; color: var(--ink); font-family: Manrope, sans-serif; }
.assistant-message p { margin: 0 0 6px; }
.assistant-message ul { margin: 0 0 6px; padding-left: 18px; }
.assistant-message .demo-tag { display: block; color: var(--muted); font-size: 11px; }
.assistant-typing { display: flex; gap: 4px; width: 56px; }
.assistant-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1s infinite alternate; }
.assistant-typing i:nth-child(2) { animation-delay: .2s; }
.assistant-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { from { opacity: .25; } to { opacity: 1; } }
.style-result-button { margin-top: 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--primary); font-size: 12.5px; font-weight: 600; }
.suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 10px; }
.suggestion-chip { padding: 6px 10px; border: 1px solid var(--line); border-radius: 20px; background: #fff; color: var(--text); font-size: 12.5px; }
.suggestion-chip:hover { border-color: #b5cfe4; color: var(--ink); }
.assistant-composer { display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.assistant-composer textarea { flex: 1; min-height: 30px; max-height: 90px; padding: 5px 0; border: 0; outline: 0; resize: none; background: transparent; }
.send-button { width: 32px; height: 32px; flex: none; border: 0; border-radius: 9px; background: var(--primary); color: #fff; font-size: 15px; }
.assistant-note { margin: 8px 4px 0; color: var(--muted); font-size: 11px; }

/* Map popups */
.sharpgis-popup .maplibregl-popup-content { padding: 10px 12px; border-radius: 9px; font-size: 12px; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }
.feature-popup strong { display: block; margin-bottom: 6px; font-size: 12.5px; }
.feature-popup dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; max-height: 220px; margin: 0; overflow: auto; }
.feature-popup dt { color: var(--muted); }
.feature-popup dd { margin: 0; overflow-wrap: anywhere; }
.feature-popup p { margin: 0; color: var(--muted); }
.feature-popup-more { margin-top: 8px; padding: 0; border: 0; background: none; color: var(--primary); font-size: 12px; font-weight: 600; }

/* Dialogs */
.auth-dialog { width: min(440px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 16px; box-shadow: 0 24px 60px rgba(19, 41, 61, .25); }
.auth-dialog::backdrop { background: rgba(19, 41, 61, .35); }
.auth-card { position: relative; display: grid; gap: 12px; padding: 26px; }
.auth-card h2 { margin: 0; font-size: 22px; font-weight: 800; }
.dialog-kicker { margin: 0; color: var(--primary); font-size: 11px; font-weight: 700; letter-spacing: 1px; }
.auth-intro { margin: 0; color: var(--text); }
.auth-card label { display: grid; gap: 5px; color: var(--text); font-size: 13px; font-weight: 500; }
.auth-card input:not([type="checkbox"]), .auth-card select { height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.auth-submit { margin-top: 4px; }
.auth-disclaimer { color: var(--muted); font-size: 12px; text-align: center; }
.dialog-close { position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; border: 0; border-radius: 8px; background: var(--bg); color: var(--text); font-size: 17px; }
.button-quiet { background: #fff; }

/* Fix location dialog */
.location-fix-dialog { width: min(520px, calc(100vw - 32px)); }
.location-fix-card { max-height: calc(100vh - 40px); overflow: auto; }
.location-fix-card h2 { overflow-wrap: anywhere; }
.fix-columns { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); }
.fix-section-label { margin-top: 4px; color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: 1px; }
.fix-suggestions, .fix-search-results { display: grid; gap: 6px; }
.fix-search-results { max-height: 180px; overflow: auto; }
.fix-suggestion, .fix-search-result { padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 13px; text-align: left; }
.fix-suggestion:first-child { border-color: #9fd4b8; background: #f2fbf6; }
.fix-suggestion:hover, .fix-search-result:hover { border-color: var(--accent); }
.fix-suggestion[aria-selected="true"], .fix-search-result[aria-selected="true"] { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(52, 152, 219, .18); }
.fix-empty { margin: 0; color: var(--muted); font-size: 12.5px; }
.fix-status { min-height: 16px; margin: 0; color: var(--text); font-size: 12.5px; }
.fix-status.error { color: var(--danger); }
.fix-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fix-actions-spacer { flex: 1; }


/* Small screens: panels stack over the map, the assistant becomes a bottom sheet */
@media (max-width: 900px) {
  .steps { grid-template-columns: 1fr; }
  .map-legend { display: none; }
  .attr-table { right: 14px; }
  .layer-options { left: 14px; top: 70px; width: calc(100% - 28px); }
  .zoom-controls { left: auto; right: 14px; top: 14px; bottom: auto; }
  .zoom-indicator { left: auto; right: 62px; top: 20px; bottom: auto; }
  .basemap-switch { top: auto; bottom: calc(45% + 26px); }
}
@media (max-width: 560px) {
  .site-bar .site-actions .btn-secondary { display: none; }
  .picker-toolbar { flex-wrap: wrap; }
}

/* Accounts (Milestone 3) */
.google-button { width: 100%; height: 42px; border: 1px solid var(--line); background: #fff; font-weight: 600; }
.or-line { margin: 0; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-error { margin: 0; padding: 8px 10px; border-radius: 8px; background: #fff3ee; color: var(--danger); font-size: 13px; }
.auth-error.info { background: var(--mint); color: var(--primary); }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 13px; }
.link-button { padding: 0; border: 0; background: none; color: var(--primary); font-weight: 600; font-size: 13px; }
.profile { position: relative; }
.avatar { width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--mint); color: var(--primary); font: 700 12px Manrope, sans-serif; }
.profile-menu { position: absolute; z-index: 20; right: 0; top: 42px; min-width: 220px; padding: 12px; display: grid; gap: 4px; border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.profile-menu small { color: var(--muted); overflow-wrap: anywhere; }
.profile-menu button { margin-top: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-weight: 600; text-align: left; }
.picker-signin { margin: 18px 0; padding: 22px; display: grid; gap: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.picker-signin span { color: var(--text); }
.picker-signin div { display: flex; flex-wrap: wrap; gap: 8px; }
.guest-banner { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 8px 14px; background: #fff8e6; border-bottom: 1px solid #f3e2b3; color: #6b4e0a; font-size: 13px; }

/* Tools (Milestone 4) */
.tool-form, .draw-bar { display: grid; gap: 8px; }
.tool-head { display: grid; }
.tool-head b, .tool-list b { font-size: 13px; }
.tool-head small { color: var(--muted); font-size: 11.5px; }
.tool-back { justify-self: start; }
.tool-field { display: grid; gap: 3px; font-size: 12px; color: var(--muted); }
.tool-field input, .tool-field select { width: 100%; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; font: inherit; color: var(--text); background: #fff; }
.tool-field small { font-size: 11px; }
.tool-jobs { display: grid; gap: 6px; margin-top: 8px; }
.tool-job { display: grid; gap: 3px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font-size: 12px; }
.tool-job small { color: var(--muted); }
.tool-job.done { border-color: #b7dfd5; }
.tool-job.failed { border-color: #f0c2b4; }
.tool-job progress { width: 100%; height: 6px; }
.draw-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.draw-actions button:not(.btn) { padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 12px; }
.opt-origin { margin: 0 0 8px; color: var(--muted); font-size: 12px; }
.opt-download { display: flex; gap: 6px; margin: 0 0 8px; }
.opt-download button { padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 12px; }

/* Attribute table editing */
.attr-table.editing td[data-column] { cursor: text; background: #fffdf5; }
.attr-table.editing td[data-column]:hover { outline: 1px solid var(--line); }
.attr-input { width: 100%; min-width: 80px; padding: 3px 5px; border: 1px solid #0f7b6c; border-radius: 4px; font: inherit; }
td.saving { opacity: .6; }

/* Map navigation buttons */
.zoom-controls { left: auto; right: 388px; top: 14px; bottom: auto; gap: 2px; padding: 5px; border-radius: 14px; border: 1px solid var(--line); }
.zoom-controls button { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; color: var(--ink); }
.zoom-controls button:hover { background: #eaf4fc; color: #1d6496; }
.zoom-controls button:active { transform: scale(.95); }
.zoom-controls button:focus-visible { outline: 2px solid #2477b3; outline-offset: 1px; }
.zoom-controls svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.zoom-divider { height: 1px; margin: 3px 6px; background: var(--line); }
.zoom-indicator { left: auto; right: 448px; top: 24px; bottom: auto; }
/* Drawing: crosshair over the map, whatever MapLibre sets */
.map-view.drawing .maplibregl-canvas-container, .map-view.drawing .maplibregl-canvas { cursor: crosshair !important; }
/* Movable panels: drag by their header */
.drag-handle { cursor: grab; user-select: none; }
.dragging, .dragging .drag-handle { cursor: grabbing !important; }
.dragging { box-shadow: 0 18px 50px rgba(19, 41, 61, .28) !important; transition: none !important; }
.moved-panel { position: absolute !important; margin: 0 !important; transform: none !important; }
.attr-table { resize: both; min-width: 360px; }
@media (max-width: 900px) {
  .zoom-controls { right: 14px; }
  .zoom-indicator { right: 72px; }
}
.zoom-controls svg { pointer-events: none; }

/* Left dock: Layers and Assistant as tabs; Tools on the right */
.tools-dock { position: absolute; z-index: 3; right: 14px; top: 14px; width: 250px; max-height: calc(100% - 28px); overflow: auto; }
.tools-dock .panel-body { padding-top: 0; }
.tool-search { margin: 0 0 8px; width: 100%; }
.tools-dock .tool-list { gap: 4px; }
.tools-dock .tool-list button { padding: 7px 9px; }
.tools-dock .tool-list b { font-size: 12.5px; }
.tools-dock .tool-list small { font-size: 11px; }
.zoom-controls { right: 278px; }
.zoom-indicator { right: 338px; }
.map-legend { right: 278px; }
.attr-table { right: 278px; }
.layer-options { left: 346px; }
@media (max-width: 900px) {
  .tools-dock { top: auto; bottom: 14px; left: 14px; right: 14px; width: auto; max-height: 45%; }
  .zoom-controls { right: 14px; }
  .attr-table, .map-legend { right: 14px; }
  .layer-options { left: 14px; }
}
/* Map buttons along the bottom right, out of the way of the Tools panel */
.zoom-controls { top: auto; right: 14px; bottom: 26px; display: flex; flex-direction: row; align-items: center; }
.zoom-divider { width: 1px; height: 24px; margin: 0 3px; }
.zoom-indicator { top: auto; right: 14px; bottom: 86px; }
.tools-dock { max-height: calc(100% - 110px); }
@media (max-width: 900px) { .zoom-controls { top: 14px; bottom: auto; } .zoom-indicator { top: 76px; bottom: auto; } }
.map-canvas { isolation: isolate; } /* panels stack among themselves, under menus and toasts */
.drag-handle { touch-action: none; }
@media (max-width: 900px) {
  .zoom-controls { flex-direction: column; }
  .zoom-divider { width: 24px; height: 1px; margin: 3px 0; }
}

.toast-action button:hover { background: rgba(255, 255, 255, .14); }

/* Ready-made layers list (under Add data) */
.add-ready { border-style: solid; border-color: var(--line); color: var(--ink); }
.ready-layers { margin-top: 6px; display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.ready-layer { padding: 8px 9px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.ready-layer > span { min-width: 0; flex: 1; display: grid; gap: 2px; }
.ready-layer strong { color: var(--ink); font-size: 13px; }
.ready-layer small { color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.ready-layer button { flex: none; min-width: 58px; height: 30px; padding: 0 10px; border: 1px solid var(--accent); border-radius: 7px; background: #fff; color: var(--primary); font-weight: 700; font-size: 12px; cursor: pointer; }
.ready-layer button:hover:not(:disabled) { background: var(--mint); }
.ready-layer button:disabled { border-color: var(--line); color: var(--muted); cursor: default; }

/* Location check notice in a layer row */
.location-check { margin-top: 5px; padding: 6px 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; border: 1px solid #f0c7a8; border-radius: 7px; background: #fff6ef; color: #7a3d17; font-size: 11.5px; line-height: 1.35; }
.location-check span { flex: 1 1 100%; }
.location-check button { padding: 3px 9px; border: 1px solid #d9844f; border-radius: 6px; background: #fff; color: #9a4a1c; font-size: 11px; font-weight: 700; cursor: pointer; }
.location-check button.quiet { border-color: transparent; background: none; font-weight: 600; }

/* Share dialog */
.share-dialog { display: grid; gap: 12px; }
.share-link { display: flex; gap: 8px; }
.share-link input { min-width: 0; flex: 1; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); font: inherit; font-size: 13px; }
.share-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---- Workspace toolbar (along the top) ---- */
.i { width: 18px; height: 18px; flex: none; display: block; }
.i-small { width: 14px; height: 14px; opacity: .7; }
.ws-toolbar { min-width: 0; margin-left: 10px; display: flex; align-items: center; gap: 4px; }
.tb-group { display: flex; align-items: center; gap: 2px; padding: 0 6px; border-left: 1px solid var(--line); }
.tb-group:first-child { padding-left: 0; border-left: 0; }
.tb-btn { height: 36px; padding: 0 10px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--text); font-weight: 600; font-size: 13px; white-space: nowrap; }
.tb-btn:hover { background: var(--bg); color: var(--ink); }
.tb-btn[aria-expanded="true"] { background: var(--mint); color: var(--primary); }
.tb-btn.tb-primary { border-color: var(--primary); background: var(--primary); color: #fff; }
.tb-btn.tb-primary:hover { border-color: var(--primary-hover); background: var(--primary-hover); }
.tb-menu { position: relative; }
.tool-menu { position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; width: 290px; max-height: min(460px, calc(100vh - 120px)); padding: 10px; overflow: auto; border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.tool-menu .tool-search { width: 100%; margin: 0 0 8px; }
.tool-menu .tool-list { gap: 4px; }
.tool-menu .tool-list button { border-color: transparent; }
.tool-menu .tool-list button:hover { border-color: var(--line); background: var(--bg); }
.tools-dock .panel-head { gap: 6px; }
.tools-dock .panel-head h2 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-back { display: inline-flex; align-items: center; gap: 4px; }
.tool-back::before { content: ""; width: 7px; height: 7px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin-right: 2px; }
.map-legend, .attr-table { right: 14px; }
@media (max-width: 700px) {
  .ws-bar { height: auto; flex-wrap: wrap; padding: 8px 10px; row-gap: 6px; }
  .ws-toolbar { order: 5; width: 100%; margin: 0; overflow-x: auto; scrollbar-width: none; }
  .ws-bar .spacer { display: none; }
  .ws-bar .profile { margin-left: auto; }
  .tool-menu { position: fixed; top: 110px; left: 10px; right: 10px; width: auto; }
}

/* ---- Base maps, listed under the layers ---- */
.basemap-list { margin-top: 10px; padding-top: 10px; display: grid; gap: 4px; border-top: 1px solid var(--line); }
.basemap-heading { margin: 0 4px 2px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase; }
.basemap-row { width: 100%; padding: 6px 8px; display: flex; align-items: center; gap: 10px; border: 1px solid transparent; border-radius: 9px; background: transparent; text-align: left; }
.basemap-row:hover { background: var(--bg); }
.basemap-row[aria-pressed="true"] { border-color: var(--accent); background: var(--mint); }
.basemap-row span { min-width: 0; display: grid; line-height: 1.25; }
.basemap-row strong { color: var(--ink); font-size: 13px; }
.basemap-row small { color: var(--muted); font-size: 11.5px; }
.basemap-row::after { content: ""; width: 14px; height: 14px; margin-left: auto; flex: none; border: 2px solid #c4d4e2; border-radius: 50%; }
.basemap-row[aria-pressed="true"]::after { border: 4px solid var(--accent); background: #fff; }
.basemap-thumb { width: 38px; height: 28px; flex: none; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.basemap-thumb.streets { background: linear-gradient(115deg, transparent 44%, #f3c969 44% 50%, transparent 50%), linear-gradient(20deg, transparent 58%, #fff 58% 64%, transparent 64%), #e9eee6; }
.basemap-thumb.satellite { background: radial-gradient(circle at 30% 35%, #6f8f4e 0 18%, transparent 19%), radial-gradient(circle at 72% 70%, #4f6b3a 0 22%, transparent 23%), linear-gradient(135deg, #8a7b55, #3f5a3a); }
.basemap-thumb.terrain { background: radial-gradient(ellipse at 35% 40%, #f4f1e8 0 14%, #d8d0b8 15% 30%, #b9b090 31% 46%, transparent 47%), linear-gradient(160deg, #e4e8d7, #c9cfb4); }

/* ---- Navigation controls: dropdowns, scrollbars, close and collapse buttons (one look everywhere) ---- */
select { appearance: none; -webkit-appearance: none; min-height: 34px; padding: 0 34px 0 11px !important; border: 1px solid var(--line); border-radius: 9px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9.5l6 6 6-6' fill='none' stroke='%232477b3' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center / 15px; color: var(--ink); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
select:hover { border-color: #b5cfe4; }
select:focus { outline: 0; border-color: #3498db; box-shadow: 0 0 0 3px rgba(52, 152, 219, .2); }
select:disabled { opacity: .55; cursor: default; }
* { scrollbar-width: thin; scrollbar-color: #c4d4e2 transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 8px; background: #c4d4e2; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #9fbcd6; }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
.icon-btn .i { width: 16px; height: 16px; }
.icon-btn.small .i { width: 14px; height: 14px; }
.icon-btn:hover { background: #eef5fb; color: #2477b3; border-color: #cfe1f1; }
.dialog-close { display: grid; place-items: center; color: var(--muted); transition: background .15s, color .15s; }
.dialog-close .i { width: 16px; height: 16px; }
.dialog-close:hover { background: #eef5fb; color: #2477b3; }
.collapse-icon { transition: transform .2s; }
.is-collapsed .collapse-icon { transform: rotate(-90deg); }
.back-workspaces { border-radius: 50%; color: var(--ink); }
.back-workspaces .i { width: 18px; height: 18px; }

/* ---- Resizable panels (panels.js): a grip on every edge and corner ---- */
.attr-table { resize: none; }
.rz { position: absolute; z-index: 20; touch-action: none; }
.rz-n, .rz-s { left: 12px; right: 12px; height: 7px; cursor: ns-resize; }
.rz-n { top: 0; } .rz-s { bottom: 0; }
.rz-e, .rz-w { top: 12px; bottom: 12px; width: 7px; cursor: ew-resize; }
.rz-e { right: 0; } .rz-w { left: 0; }
.rz-ne, .rz-nw, .rz-se, .rz-sw { width: 14px; height: 14px; }
.rz-ne { top: 0; right: 0; cursor: nesw-resize; } .rz-sw { bottom: 0; left: 0; cursor: nesw-resize; }
.rz-nw { top: 0; left: 0; cursor: nwse-resize; } .rz-se { bottom: 0; right: 0; cursor: nwse-resize; }
.rz-n:hover, .rz-s:hover, .resizing > .rz-n, .resizing > .rz-s { background: linear-gradient(transparent 2px, rgba(52, 152, 219, .55) 2px 5px, transparent 5px); }
.rz-e:hover, .rz-w:hover, .resizing > .rz-e, .resizing > .rz-w { background: linear-gradient(90deg, transparent 2px, rgba(52, 152, 219, .55) 2px 5px, transparent 5px); }
.attr-table .rz-n::after { content: ""; position: absolute; left: 50%; top: 2px; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: #c4d4e2; }
.resizing { user-select: none; }
.map-legend[style*="height"] { overflow: auto; max-height: none; max-width: none; }
.tools-dock[style*="height"], .layer-options[style*="height"] { max-height: none; }
@media (max-width: 900px) { .rz { display: none; } }
/* The attribute table starts beside the Layers panel, not over it. */
@media (min-width: 901px) { .attr-table:not(.moved-panel) { left: 348px; } }
/* The legend sits above the zoom buttons in the bottom-right corner. */
.map-legend:not(.moved-panel) { right: 14px; bottom: 84px; }
.zoom-indicator { bottom: 84px; right: 250px; }

/* Older rules set a plain background on some dropdowns: keep the arrow on all of them. */
.field-label select, .tool-field select, .auth-card select, .opt-row select { background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9.5l6 6 6-6' fill='none' stroke='%232477b3' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center / 15px; }
/* Wide tables scroll sideways instead of squeezing their columns. */
.attr-table table { width: max-content; min-width: 100%; }
.attr-table td { white-space: nowrap; max-width: 360px; overflow: hidden; text-overflow: ellipsis; }

/* ---- Land suitability panel and report ---- */
.tb-btn.tb-feature { color: var(--primary); background: var(--mint); }
.tb-btn.tb-feature:hover { background: #dcecfa; }
.suit-panel { position: absolute; z-index: 6; right: 14px; top: 14px; width: 380px; max-height: calc(100% - 28px); overflow: auto; }
.suit-panel .panel-head h2 { flex: 1; }
.suit-field { margin: 8px 0; display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 8px; color: var(--text); font-size: 12.5px; }
.suit-field > span { font-weight: 600; }
.suit-field select, .suit-field input[type="number"], .suit-field input[type="text"] { width: 100%; min-width: 0; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background-color: #fff; font-size: 13px; }
.suit-step { margin: 14px 0 6px; color: var(--text); font-size: 12.5px; font-weight: 600; }
.suit-card { margin-bottom: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfe; }
.suit-card-head { display: flex; gap: 6px; align-items: center; }
.suit-name { min-width: 0; flex: 1; height: 32px; padding: 0 8px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ink); font-weight: 700; font-size: 13.5px; }
.suit-name:hover, .suit-name:focus { border-color: var(--line); background: #fff; outline: 0; }
.suit-rules { margin: 6px 0; padding: 8px; display: grid; gap: 5px; border-radius: 9px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.suit-rule { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.suit-class { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.suit-other span { flex: 1; color: var(--muted); }
.suit-range input { width: 64px; height: 30px; padding: 0 6px; border: 1px solid var(--line); border-radius: 7px; font-size: 12.5px; }
.suit-range > span { color: var(--muted); font-size: 12px; }
.suit-unit { width: 18px; }
.suit-score { height: 30px; min-height: 30px; margin-left: auto; font-size: 12.5px; }
.suit-drop { width: 24px; height: 24px; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 16px; }
.suit-drop:hover { background: #fdecea; color: var(--danger); }
.suit-rule-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 2px; }
.suit-rule-actions .link-button { padding: 0; border: 0; background: none; color: var(--primary); font-size: 12px; font-weight: 600; cursor: pointer; }
.suit-weight-row { grid-template-columns: 92px 1fr 42px; }
.suit-weight-row input { accent-color: var(--primary); }
.suit-weight { color: var(--ink); font-weight: 700; text-align: right; }
.suit-more { margin: 10px 0; color: var(--text); font-size: 12.5px; }
.suit-more summary { cursor: pointer; font-weight: 600; }
.suit-run { width: 100%; margin-top: 4px; }
.report-dialog { width: min(720px, calc(100vw - 32px)); }
.report-dialog .auth-card { max-height: calc(100vh - 48px); overflow: auto; }
.report-dialog h3 { margin: 18px 0 8px; font-size: 14px; }
.report-summary { margin: 4px 0 0; padding: 12px 14px; border-radius: 11px; background: var(--mint); color: var(--ink); font-size: 14.5px; line-height: 1.5; }
.report-bars { display: grid; gap: 7px; }
.report-bar { display: grid; grid-template-columns: 170px 1fr 150px; align-items: center; gap: 10px; font-size: 13px; }
.report-bar-label { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.report-bar-label i { width: 14px; height: 14px; border-radius: 3px; flex: none; }
.report-bar-track { height: 12px; border-radius: 6px; background: var(--bg); overflow: hidden; }
.report-bar-fill { display: block; height: 100%; border-radius: 6px; }
.report-bar-value { color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
.report-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.report-table th { padding: 6px 8px; background: var(--bg); color: var(--text); font-weight: 600; text-align: left; }
.report-table td { padding: 7px 8px; border-top: 1px solid var(--line); vertical-align: top; }
.report-table td small { display: block; color: var(--muted); }
.report-steps, .report-notes { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--text); font-size: 13px; line-height: 1.5; }
@media (max-width: 900px) { .suit-panel { left: 14px; right: 14px; width: auto; top: auto; bottom: 14px; max-height: 70%; } .report-bar { grid-template-columns: 1fr; gap: 3px; } .report-bar-value { text-align: left; } }

/* Thematic maps: Colour by, and classes in the legend */
#optThemeRow { display: grid; gap: 6px; }
#optThemeRow select { width: 100%; height: 32px; min-height: 32px; font-size: 12.5px; }
.theme-settings { display: grid; gap: 6px; }
.theme-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.map-legend > span.legend-class { padding-left: 8px; color: var(--text); }
.legend-body > span:not(.legend-class) + span.legend-class { margin-top: -2px; }
.theme-pair:has(select[hidden]) { grid-template-columns: 1fr; }
/* Landing: four steps, two by two on medium screens */
.steps { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .steps { grid-template-columns: 1fr; } }
.hero .kicker { margin-bottom: 14px; }

/* "Find the best land": crop cards and the read-only list of what is looked at */
.crop-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.crop-choices button { padding: 12px 6px 10px; display: grid; justify-items: center; gap: 2px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; }
.crop-choices button:hover { border-color: #b5cfe4; }
.crop-choices button[aria-checked="true"] { border-color: var(--accent); background: var(--mint); box-shadow: 0 0 0 3px rgba(52, 152, 219, .15); }
.crop-icon { font-size: 26px; line-height: 1.2; }
.crop-choices strong { color: var(--ink); font-size: 13.5px; }
.crop-choices small { color: var(--muted); font-size: 11.5px; }
#suitPlace { width: 100%; height: 38px; font-size: 13.5px; }
.suit-looks { margin-top: 6px; }
.suit-looks ul { margin: 0 0 8px; padding: 0; list-style: none; display: grid; gap: 8px; }
.suit-looks li { padding: 8px 10px; border-radius: 10px; background: var(--bg); font-size: 13px; }
.suit-looks li small { display: block; margin-top: 2px; color: var(--text); font-size: 12px; line-height: 1.4; }
.suit-weight-word { color: var(--primary); font-weight: 600; font-size: 12px; }
.suit-run { height: 44px; font-size: 15px; }
.suit-panel { width: 360px; }

/* Assistant: plan card and follow-up suggestions */
.assistant-looks { margin: 6px 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.assistant-looks li { padding: 7px 9px; border-radius: 9px; background: var(--bg); }
.assistant-looks em { color: var(--primary); font-style: normal; font-size: 12px; font-weight: 600; }
.assistant-looks small { display: block; margin-top: 1px; color: var(--text); font-size: 12px; line-height: 1.4; }
.assistant-followups { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.assistant-followups .suggestion-chip { font-size: 12px; }

/* The assistant couldn't answer: a clear notice in the conversation, with Try again. */
.assistant-message.assistant-error { border: 1px solid #f3c7c0; background: #fff4f2; color: #7b2b20; }
.assistant-error strong { color: #a5301f; }
.assistant-error p { margin: 4px 0 8px; }
.assistant-note-off { color: #a5301f; }


/* Workspace picker cards: a picture of the map where the person left off, then name and details */
.workspace-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.workspace-card { position: relative; padding: 0; display: flex; flex-direction: column; align-items: stretch; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--card); text-align: left; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.workspace-card:hover, .workspace-card:focus-visible { border-color: #a9cbe6; box-shadow: 0 10px 26px rgba(19, 41, 61, .1); transform: translateY(-2px); }
.workspace-card:focus-visible { outline: 3px solid rgba(52, 152, 219, .35); outline-offset: 2px; }
.ws-thumb { position: relative; aspect-ratio: 16 / 9; display: grid; place-items: center; overflow: hidden; background: #e9eef2; border-bottom: 1px solid var(--line); }
.ws-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.workspace-card:hover .ws-thumb img { transform: scale(1.03); }
.ws-thumb-empty { align-content: center; gap: 6px; background: linear-gradient(135deg, #eef5fb 0%, #e3eef7 100%); color: #7fa3c0; }
.ws-thumb-empty::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(36, 119, 179, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(36, 119, 179, .06) 1px, transparent 1px); background-size: 22px 22px; }
.ws-thumb svg { position: relative; width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
.ws-thumb-empty small { position: relative; color: #6b8aa3; font-size: 12px; }
.ws-badge { position: absolute; left: 10px; bottom: 10px; padding: 3px 8px; border-radius: 999px; background: rgba(255, 255, 255, .92); color: var(--ink); font-size: 11.5px; font-weight: 700; box-shadow: 0 1px 4px rgba(19, 41, 61, .12); }
.ws-info { padding: 13px 15px 15px; display: grid; gap: 4px; }
.ws-info strong { font: 700 15.5px Manrope, sans-serif; color: var(--ink); overflow-wrap: anywhere; }
.ws-info small { color: var(--muted); font-size: 12.5px; }
.workspace-card .open-hint { position: absolute; top: 10px; right: 10px; padding: 4px 10px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 12px; font-weight: 700; opacity: 0; transition: opacity .15s; }
.workspace-card:hover .open-hint, .workspace-card:focus-visible .open-hint { opacity: 1; }
.new-card { border-style: dashed; border-color: #b9d3e8; background: #fbfdff; }
.ws-thumb-new { background: #f1f7fc; color: var(--primary); }
.ws-thumb-new svg { width: 44px; height: 44px; padding: 10px; border-radius: 50%; background: #fff; stroke-width: 2; stroke-linecap: round; box-shadow: 0 2px 8px rgba(36, 119, 179, .15); }
@media (hover: none) { .workspace-card .open-hint { opacity: 1; } }
.search-icon { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; }

/* Toolbar toggles (Measure) */
.tb-btn[aria-pressed="true"] { background: var(--mint); color: var(--primary); }
.segmented button[aria-pressed="true"] { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }

/* Find a place: a search box at the top centre of the map */
.place-results { position: absolute; left: 0; right: 0; top: 42px; min-width: 260px; margin: 0; padding: 5px; list-style: none; border-radius: 11px; background: #fff; box-shadow: var(--shadow); max-height: 320px; overflow: auto; }
.place-results li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; padding: 8px 9px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.place-results li:hover, .place-results li[aria-selected="true"] { background: var(--mint); }
.place-results li .i { width: 16px; height: 16px; color: var(--primary); }
.place-results b { color: var(--ink); font-weight: 600; }
.place-results small { color: var(--muted); font-size: 11.5px; }
.place-results .place-empty, .export-list .place-empty { display: block; color: var(--muted); cursor: default; }
.place-results .place-empty:hover { background: none; }
.place-marker { width: 26px; height: 34px; background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 34'%3E%3Cpath d='M13 33S2 21.5 2 12.5a11 11 0 0 1 22 0C24 21.5 13 33 13 33Z' fill='%23e4572e' stroke='%23fff' stroke-width='2'/%3E%3Ccircle cx='13' cy='12.5' r='4' fill='%23fff'/%3E%3C/svg%3E"); filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .3)); }

/* Tools running: a card at the bottom centre with a progress ring per run, and Cancel */
.jobs-card, .measure-card { position: absolute; z-index: 6; border-radius: 14px; background: #fff; box-shadow: var(--shadow); }
.jobs-card { left: 50%; bottom: 24px; transform: translateX(-50%); width: min(380px, calc(100% - 28px)); }
.jobs-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 14px; }
.jobs-head strong { font: 700 13.5px Manrope, sans-serif; color: var(--ink); }
.jobs-head .count { min-width: 20px; padding: 1px 6px; border-radius: 999px; background: var(--mint); color: var(--primary); font-size: 11.5px; font-weight: 700; text-align: center; }
.jobs-head .icon-btn { margin-left: auto; }
.jobs-card.collapsed .jobs-list { display: none; }
.jobs-card.collapsed .collapse-icon, .map-legend.collapsed .collapse-icon { transform: rotate(-90deg); }
.jobs-list { display: grid; gap: 6px; max-height: 260px; overflow: auto; padding: 0 10px 10px; }
.tool-job { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 11px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 11px; background: #fbfdff; }
.job-ring { width: 38px; height: 38px; transform: rotate(-90deg); }
.job-ring circle { fill: none; stroke-width: 3.5; }
.job-ring-track { stroke: #e3edf5; }
.job-ring-fill { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .5s ease; }
.job-ring-mark { fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transform: rotate(90deg); transform-origin: 18px 18px; }
.tool-job:not(.done):not(.failed):not(.cancelled) .job-ring { animation: job-spin-pulse 2s ease-in-out infinite; }
@keyframes job-spin-pulse { 50% { opacity: .75; } }
.tool-job.done .job-ring-fill { stroke: #1e9e5a; }
.tool-job.done .job-ring-mark { stroke: #1e9e5a; }
.tool-job.failed { border-color: #f1c3bc; background: #fff7f6; }
.tool-job.failed .job-ring-fill, .tool-job.failed .job-ring-mark { stroke: #c0392b; }
.tool-job.cancelled .job-ring-fill { stroke: #9aa9b5; }
.job-text { min-width: 0; display: grid; gap: 2px; }
.job-text b { color: var(--ink); font-size: 13px; font-weight: 700; }
.job-text small { color: var(--muted); font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.job-cancel { padding: 5px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.job-cancel:hover:not(:disabled) { border-color: #e2b1a8; color: #a5301f; background: #fff4f2; }
.job-close:hover { border-color: #c4d4e2 !important; color: var(--ink) !important; background: var(--bg) !important; }
@media (prefers-reduced-motion: reduce) { .job-ring-fill { transition: none; } .tool-job .job-ring { animation: none !important; } }

/* Measure */
.measure-card { right: 14px; top: 64px; width: 260px; padding-bottom: 12px; }
.measure-card > :not(header) { margin-left: 14px; margin-right: 14px; }
.measure-value { display: grid; gap: 2px; margin-top: 10px; }
.measure-value b { font: 800 22px Manrope, sans-serif; color: var(--ink); }
.measure-value small { color: var(--text); font-size: 12.5px; }
.measure-value small:empty { display: none; }
.measure-card .panel-note { margin-top: 4px; margin-bottom: 10px; }

/* Legend card with a header that collapses it */
.map-legend { display: block; padding: 0; }
.legend-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 6px 12px; cursor: move; }
.legend-head strong { font: 700 12.5px Manrope, sans-serif; }
.legend-head .icon-btn { margin-left: auto; }
.legend-body { display: grid; gap: 5px; padding: 0 12px 10px; overflow: auto; }
.legend-body > span { display: flex; align-items: center; gap: 7px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.legend-body > span.legend-class { padding-left: 8px; color: var(--text); }
.map-legend.collapsed .legend-body { display: none; }
.map-legend.collapsed { height: auto !important; }

/* Export menu */
.export-menu { right: 0; left: auto; width: 300px; }
.menu-title { margin: 2px 4px 6px; color: var(--muted); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.export-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; max-height: 320px; overflow: auto; }
.export-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 6px; border-radius: 8px; font-size: 13px; }
.export-list li:hover { background: var(--bg); }
.export-list li > span:first-child { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--ink); }
.export-formats { display: flex; gap: 4px; flex: none; }
.export-formats button { padding: 3px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--primary); font-size: 11.5px; font-weight: 700; cursor: pointer; }
.export-formats button:hover { border-color: var(--accent); background: var(--mint); }

@media (max-width: 900px) {
  .measure-card { top: 70px; left: 14px; right: 14px; width: auto; }
}

/* Colour by: reverse, and the class list (colour, range, count, editable break) */
.theme-reverse { display: flex; align-items: center; gap: 7px; color: var(--text); font-size: 12.5px; cursor: pointer; }
.theme-classes { display: grid; gap: 3px; max-height: 260px; overflow: auto; padding: 4px; border: 1px solid var(--line); border-radius: 9px; background: #fbfdff; }
.theme-class { display: grid; grid-template-columns: 26px 1fr 74px; align-items: center; gap: 7px; padding: 3px 4px; border-radius: 6px; font-size: 12px; }
.theme-class-text { min-width: 0; display: grid; line-height: 1.25; }
.theme-class:hover { background: #fff; }
.theme-class input[type="color"] { width: 24px; height: 22px; padding: 0; border: 1px solid var(--line); border-radius: 5px; background: none; cursor: pointer; }
.theme-class input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.theme-class input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 3px; }
.theme-class-label { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--ink); }
.theme-class small { color: var(--muted); font-size: 11px; white-space: nowrap; }
.theme-break { width: 100%; height: 24px; padding: 0 5px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--ink); font-size: 11.5px; }
.theme-break:focus { border-color: var(--accent); outline: none; }
.theme-class:has(> :nth-child(2):last-child) { grid-template-columns: 26px 1fr; }
.theme-hint { margin: 0; color: var(--muted); font-size: 11.5px; line-height: 1.4; }

@media (max-width: 900px) { .map-legend:not([hidden]) { display: block; } }

/* ---- Side panels (dock.js): Layers on the left, the Assistant on the right ----------------
   Pinned: full height against their side; the map (and every card over it) makes room through
   --l / --r. Floating: a card over the map, moved by its header and resized from any edge.
   --lf / --rf say where floating side panels end, so other cards open beside them. */
.map-canvas { --l: 0px; --r: 0px; --lf: 0px; --rf: 0px; }
.map-view { left: var(--l); right: var(--r); }
.dock-panel { position: absolute; z-index: 4; display: flex; flex-direction: column; min-height: 0; background: #fff; }
.dock-panel[hidden] { display: none !important; }
.dock-panel > .panel-body { flex: 1; min-height: 0; overflow: auto; }
.dock-panel.assistant > .panel-body { display: flex; flex-direction: column; overflow: hidden; }
.dock-head { display: flex; align-items: center; gap: 4px; padding: 10px 10px 8px 14px; border-bottom: 1px solid transparent; }
.dock-head h2 { flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; margin: 0; font: 700 14px Manrope, sans-serif; color: var(--ink); }
.dock-head .count { min-width: 20px; padding: 1px 6px; border-radius: 999px; background: var(--bg); color: var(--muted); font: 600 11px "DM Sans", sans-serif; text-align: center; }
.dock-head .icon-btn { border-color: transparent; background: transparent; color: var(--muted); }
.dock-head .icon-btn:hover { background: var(--bg); color: var(--ink); }
.dock-pin[aria-pressed="true"] { color: var(--primary); }
.dock-pin[aria-pressed="false"] .i { transform: rotate(40deg); }
.dock-panel.pinned { top: 0; bottom: 0; border-radius: 0; box-shadow: none; }
.dock-panel.pinned[data-side="left"] { left: 0; border-right: 1px solid var(--line); }
.dock-panel.pinned[data-side="right"] { right: 0; border-left: 1px solid var(--line); }
.dock-panel.pinned .dock-head { border-bottom-color: var(--line); }
.dock-panel.pinned > .rz { display: none; }
.dock-panel.floating { border-radius: 12px; box-shadow: var(--shadow); max-height: calc(100% - 28px); }
.dock-panel.floating[data-side="left"]:not(.moved-panel) { left: 14px; top: 14px; width: 300px; }
.dock-panel.floating[data-side="right"]:not(.moved-panel) { right: 14px; top: 14px; bottom: 14px; width: 360px; }
.dock-panel.floating .dock-head { cursor: move; }
.dock-grip { display: none; position: absolute; top: 0; bottom: 0; width: 9px; z-index: 6; cursor: col-resize; touch-action: none; }
.dock-panel.pinned .dock-grip { display: block; }
.dock-panel[data-side="left"] .dock-grip { right: -5px; }
.dock-panel[data-side="right"] .dock-grip { left: -5px; }
.dock-grip::after { content: ""; position: absolute; top: 0; bottom: 0; left: 4px; width: 1px; background: transparent; transition: background .15s; }
.dock-grip:hover::after, .dock-panel.resizing .dock-grip::after { left: 3px; width: 3px; background: var(--accent); }
body.dock-resizing { cursor: col-resize; user-select: none; }
body.dock-resizing .map-view { pointer-events: none; }
.tb-toggle[aria-pressed="true"] { color: var(--ink); background: var(--bg); }
.tb-assistant { flex: none; }

/* Cards over the map stay inside the map area, beside pinned or floating side panels. */
.layer-options:not(.moved-panel) { left: calc(max(var(--l), var(--lf)) + 12px); top: 12px; }
.tools-dock:not(.moved-panel), .suit-panel:not(.moved-panel) { right: calc(max(var(--r), var(--rf)) + 12px); top: 12px; }
.measure-card { right: calc(max(var(--r), var(--rf)) + 12px); top: 12px; }
.zoom-controls { right: calc(var(--r) + 14px) !important; }
.zoom-indicator { right: calc(var(--r) + 14px); }
.map-legend:not(.moved-panel) { right: calc(var(--r) + 14px); }
.attr-table:not(.moved-panel) { left: calc(var(--l) + 14px) !important; right: calc(var(--r) + 14px) !important; }
.jobs-card { left: calc(var(--l) + (100% - var(--l) - var(--r)) / 2); }
.map-canvas .maplibregl-ctrl-bottom-left { left: 10px; }

/* Phones: the side panels are bottom sheets, one at a time */
@media (max-width: 900px) {
  .dock-panel { left: 0 !important; right: 0 !important; top: auto !important; bottom: 0 !important; width: auto !important; height: 58% !important; border-radius: 14px 14px 0 0; box-shadow: 0 -8px 30px rgba(19, 41, 61, .18); }
  .dock-pin, .dock-grip, .dock-panel > .rz { display: none !important; }
}

/* ---- Notices: quiet cards in the manner of Vercel's Geist / Sonner toasts. A white card with a
   hairline border and a small coloured icon; the close button appears on hover or focus. */
.toast-region { position: fixed; z-index: 100; top: 68px; left: 50%; transform: translateX(-50%); width: min(380px, calc(100vw - 32px)); display: grid; gap: 8px; pointer-events: none; }
.toast { position: relative; pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 12px 34px 12px 14px; border: 1px solid #e5e7eb; border-radius: 10px; background: #fff; color: #111827; font-size: 13px; line-height: 1.45; box-shadow: 0 4px 12px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04); animation: toast-in .18s ease-out; }
.toast.leaving { opacity: 0; transform: translateY(-4px); transition: opacity .15s, transform .15s; }
.toast-icon { flex: none; width: 16px; height: 16px; margin-top: 1px; color: #6b7280; }
.toast-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.toast-icon circle { fill: currentColor; stroke: none; }
.toast-success .toast-icon { color: #16a34a; }
.toast-info .toast-icon { color: var(--primary); }
.toast-warning .toast-icon { color: #d97706; }
.toast-error .toast-icon { color: #dc2626; }
.toast-body { min-width: 0; flex: 1; display: grid; gap: 2px; }
.toast-body strong { font-weight: 600; font-size: 13px; color: #111827; }
.toast-body span { color: #4b5563; overflow-wrap: anywhere; }
.toast-body strong + span { color: #6b7280; }
.toast-close { position: absolute; top: 8px; right: 8px; width: 20px; height: 20px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 5px; background: none; color: #9ca3af; cursor: pointer; opacity: 0; transition: opacity .12s; }
.toast:hover .toast-close, .toast-close:focus-visible, .toast-error .toast-close { opacity: 1; }
.toast-close:hover { background: #f3f4f6; color: #111827; }
.toast-close .i { width: 12px; height: 12px; }
.toast-progress .toast-body { gap: 8px; }
.toast-progress i { display: block; height: 3px; border-radius: 2px; background: linear-gradient(90deg, var(--accent) var(--done, 0%), #e5e7eb var(--done, 0%)); transition: background .2s; }
.toast-action .toast-body { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.toast-button { flex: none; padding: 4px 10px; border: 1px solid #e5e7eb; border-radius: 6px; background: #fff; color: #111827; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.toast-button:hover { background: #f9fafb; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* Form errors (sign-in, sign-up, reset, settings): plain text in the form, the fields to fix
   outlined. No banners, no shaking. */
.auth-error { margin: 0; padding: 9px 11px 9px 34px; border: 1px solid #fecaca; border-radius: 8px; background: #fef2f2 no-repeat 11px 10px / 15px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23dc2626' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='10' cy='10' r='7.5'/%3E%3Cpath d='M10 6.2v4.6'/%3E%3Ccircle cx='10' cy='13.6' r='.4' fill='%23dc2626'/%3E%3C/svg%3E"); color: #991b1b; font-size: 13px; line-height: 1.45; }
.auth-error.info { border-color: #dbeafe; background-color: #eff6ff; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%232477b3' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='10' cy='10' r='7.5'/%3E%3Cpath d='M10 9v4.6'/%3E%3Ccircle cx='10' cy='6.4' r='.4' fill='%232477b3'/%3E%3C/svg%3E"); color: #1e3a5f; }
.auth-card input[aria-invalid="true"], .settings-card input[aria-invalid="true"] { border-color: #dc2626; box-shadow: 0 0 0 3px rgba(220, 38, 38, .1); }
.assistant-message.assistant-error { border: 1px solid #fecaca; background: #fff; color: #4b5563; }
.assistant-error strong { color: #b91c1c; }

/* ---- The top bar fits itself (app.js fitToolbar()): fit-1 shows the less-used buttons as icons,
   fit-2 every button but Add data. Names stay for screen readers and as tooltips. */
.ws-toolbar { overflow: hidden; flex: 1 1 auto; }
.ws-bar .spacer { flex: 0 0 auto; }
.ws-bar.fit-1 .tb-btn.tb-compact > span, .ws-bar.fit-2 .tb-btn:not(.tb-primary) > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ws-bar.fit-1 .tb-btn.tb-compact, .ws-bar.fit-2 .tb-btn:not(.tb-primary) { padding-left: 9px; padding-right: 9px; }

/* ---- Find a place: over the map, top-left of the map area (as on Google Maps or Felt) */
.place-search { position: absolute; z-index: 5; top: 12px; left: calc(max(var(--l), var(--lf)) + 12px); width: 280px; max-width: calc(100% - var(--l) - var(--r) - 80px); }
.place-search .search-box { height: 38px; border: 1px solid #e5e7eb; border-radius: 10px; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }
.place-search .search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(52, 152, 219, .15); }
.layer-options:not(.moved-panel) { top: 60px; }
.measure-card { top: 60px; }
@media (max-width: 900px) { .place-search { width: auto; right: 64px; } }

/* ---- First sign-in: what best describes you ------------------------------------------------ */
.onboarding { min-height: 100vh; background: var(--bg); }
.onboarding .site-bar { background: var(--card); border-bottom: 1px solid var(--line); }
.onboarding-main { width: min(760px, 100%); margin: 0 auto; padding: 48px 20px 64px; }
.onboarding-step { margin: 0 0 6px; color: var(--muted); font-size: 13px; font-weight: 600; }
.onboarding-main h1 { margin: 0 0 8px; font-size: 28px; font-weight: 800; letter-spacing: -.01em; }
.onboarding-sub { margin: 0 0 24px; color: var(--text); max-width: 560px; }
.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.role-card { display: grid; gap: 3px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: #fff; text-align: left; cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.role-card strong { color: var(--ink); font-size: 14px; font-weight: 600; }
.role-card small { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.role-card:hover { border-color: #c9d6e2; }
.role-card[aria-checked="true"] { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.role-card:focus-visible { outline: 3px solid rgba(52, 152, 219, .3); outline-offset: 2px; }
.onboarding .auth-error { margin-top: 16px; }
.onboarding-actions { margin-top: 24px; display: flex; justify-content: flex-end; }
.onboarding-actions .btn { min-width: 140px; }
.onboarding-actions .btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---- Settings: a larger window over the page, with a section list on the left ------------- */
.settings-dialog { width: min(820px, calc(100vw - 32px)); height: min(560px, calc(100vh - 48px)); max-height: none; }
.settings-card { height: 100%; display: flex; flex-direction: column; }
.settings-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 14px 24px; border-bottom: 1px solid var(--line); }
.settings-head h2 { margin: 0; font-size: 18px; }
.settings-head .dialog-close { position: static; }
.settings-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 190px 1fr; }
.settings-nav { display: grid; align-content: start; gap: 2px; padding: 14px 10px; border-right: 1px solid var(--line); background: #fafbfc; }
.settings-nav [role="tab"] { padding: 8px 12px; border: 0; border-radius: 7px; background: none; color: var(--text); font: inherit; font-size: 13.5px; font-weight: 500; text-align: left; cursor: pointer; }
.settings-nav [role="tab"]:hover { background: #f0f3f6; color: var(--ink); }
.settings-nav [role="tab"][aria-selected="true"] { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 0 0 1px var(--line); }
.settings-panels { min-height: 0; overflow: auto; padding: 22px 28px; }
.settings-section { display: grid; gap: 14px; max-width: 460px; }
.settings-section h3 { margin: 0; color: var(--ink); font-size: 16px; font-weight: 700; }
.settings-lead { margin: -8px 0 4px; color: var(--muted); font-size: 13px; }
.settings-section label { display: grid; gap: 6px; color: var(--ink); font-size: 13px; font-weight: 500; }
.settings-section input:not([type="checkbox"]), .settings-section select { height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font: inherit; font-size: 14px; }
.settings-section input:focus, .settings-section select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(52, 152, 219, .15); }
.field-hint { color: var(--muted); font-size: 12px; font-weight: 400; }
.settings-note { margin: 0; color: var(--muted); font-size: 12.5px; }
.settings-signout { padding-top: 14px; border-top: 1px solid var(--line); }
.settings-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 20px 14px 24px; border-top: 1px solid var(--line); }
.settings-section input[aria-invalid="true"], .settings-section input[aria-invalid="true"]:focus { border-color: #dc2626; box-shadow: 0 0 0 3px rgba(220, 38, 38, .12); }
.settings-foot .auth-error { flex: 1 1 260px; }
.settings-actions { margin-left: auto; display: flex; gap: 8px; }
@media (max-width: 640px) {
  .settings-dialog { height: calc(100vh - 32px); }
  .settings-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .settings-nav { grid-auto-flow: column; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; }
  .settings-nav [role="tab"] { text-align: center; }
  .settings-panels { padding: 18px; }
  .settings-foot { padding: 12px 16px; }
  .settings-foot .auth-error { flex-basis: 100%; }
}
.profile-menu [data-open-settings] { margin-top: 8px; }
.profile-menu [data-open-settings] + [data-sign-out] { margin-top: 0; }

/* ---- Workspace card menu (Delete) and the confirmation ------------------------------------ */
.ws-card-wrap { position: relative; display: flex; }
.ws-card-wrap > .workspace-card { flex: 1; }
.ws-card-wrap[hidden] { display: none; }
.ws-card-more { position: absolute; z-index: 2; top: 10px; left: 10px; width: 30px; height: 30px; display: grid; place-items: center; padding: 0; border: 1px solid rgba(0, 0, 0, .06); border-radius: 8px; background: rgba(255, 255, 255, .94); color: var(--ink); cursor: pointer; opacity: 0; transition: opacity .12s; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.ws-card-wrap:hover .ws-card-more, .ws-card-more:focus-visible, .ws-card-more[aria-expanded="true"] { opacity: 1; }
.ws-card-more svg { width: 16px; height: 16px; fill: currentColor; }
.ws-card-more:hover { background: #fff; }
.ws-card-menu { position: absolute; z-index: 3; top: 44px; left: 10px; min-width: 180px; padding: 4px; border: 1px solid #e5e7eb; border-radius: 9px; background: #fff; box-shadow: 0 8px 24px rgba(0, 0, 0, .12); }
.ws-card-menu button { width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: none; font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.ws-card-menu button:hover, .ws-card-menu button:focus-visible { background: #f3f4f6; outline: none; }
.ws-card-menu .danger { color: #b91c1c; }
.ws-card-menu .danger:hover { background: #fef2f2; }
@media (hover: none) { .ws-card-more { opacity: 1; } }
.confirm-dialog { width: min(440px, calc(100vw - 32px)); }
.confirm-dialog h2 { margin: 0; font-size: 18px; }
.btn-danger { border: 1px solid #b91c1c; background: #b91c1c; color: #fff; }
.btn-danger:hover { background: #991b1b; border-color: #991b1b; }
.btn-danger:disabled { opacity: .6; }

/* Best land: the "weakest factor decides" option; report: how sure, and where the best land is */
.suit-option { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; margin: 12px 0 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.suit-option input { margin-top: 3px; }
.suit-own { margin: 12px 0 4px; border: 1px solid var(--line); border-radius: 10px; }
.suit-own summary { padding: 10px 12px; cursor: pointer; list-style: none; }
.suit-own summary::-webkit-details-marker { display: none; }
.suit-own summary strong { display: block; color: var(--ink); font-size: 13px; }
.suit-own summary small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.suit-own[open] summary { border-bottom: 1px solid var(--line); }
.suit-own-body { display: grid; gap: 8px; padding: 10px 12px 12px; }
.suit-own-body .tool-field { margin: 0; }
.suit-mapping { padding: 8px 10px; border-radius: 8px; background: var(--bg); font-size: 12px; }
.suit-mapping p { margin: 0 0 6px; color: var(--text); line-height: 1.4; }
.suit-mapping label { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: center; margin-top: 4px; }
.suit-mapping label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.suit-option strong { display: block; color: var(--ink); font-size: 13px; }
.suit-option small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.report-sure { display: flex; align-items: flex-start; gap: 12px; }
.report-sure p { margin: 2px 0 0; }
.report-sure-badge { flex: none; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.report-sure-badge.high { background: #dcfce7; color: #166534; }
.report-sure-badge.mid { background: #fef9c3; color: #854d0e; }
.report-sure-badge.low { background: #fee2e2; color: #991b1b; }
.report-places td:nth-child(2) { position: relative; min-width: 160px; }
.report-place-bar { display: inline-block; height: 8px; margin-right: 8px; border-radius: 4px; background: #1a9641; vertical-align: middle; max-width: 90px; }
.assistant-quota { display: block; margin-top: 6px; color: var(--muted); font-size: 11.5px; }
.site-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.footer-links { display: flex; gap: 16px; }
.footer-links a { color: var(--muted); text-decoration: none; font-size: 13px; }
.footer-links a:hover { color: var(--primary); }
.auth-legal { margin: 0; color: var(--muted); font-size: 12px; }
.auth-legal a { color: var(--primary); }

/* Assistant: @mention picker and chips, stages while waiting, "How I worked this out" */
.assistant-body { position: relative; }
.mention-menu { position: absolute; left: 10px; right: 10px; bottom: 96px; z-index: 5; margin: 0; padding: 4px; list-style: none; border: 1px solid #e5e7eb; border-radius: 10px; background: #fff; box-shadow: 0 8px 24px rgba(0, 0, 0, .12); max-height: 240px; overflow: auto; }
.mention-menu li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 7px; cursor: pointer; font-size: 13px; }
.mention-menu li[aria-selected="true"], .mention-menu li:hover { background: var(--mint); }
.mention-menu b { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--ink); font-weight: 600; }
.mention-menu small { flex: none; color: var(--muted); font-size: 11.5px; }
.mention { padding: 1px 6px; border-radius: 6px; background: #fff; color: var(--primary); font-weight: 600; white-space: nowrap; }
.assistant-typing { display: flex; align-items: center; gap: 10px; width: auto; }
.typing-dots { display: flex; gap: 4px; }
.typing-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1s infinite alternate; }
.typing-dots i:nth-child(2) { animation-delay: .2s; }
.typing-dots i:nth-child(3) { animation-delay: .4s; }
.assistant-stage { color: var(--muted); font-size: 12px; }
.assistant-working { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 6px; font-size: 12.5px; }
.assistant-working summary { cursor: pointer; color: var(--primary); font-weight: 600; list-style: none; }
.assistant-working summary::-webkit-details-marker { display: none; }
.assistant-working summary::before { content: "›"; display: inline-block; margin-right: 6px; transition: transform .15s; }
.assistant-working[open] summary::before { transform: rotate(90deg); }
.assistant-working ol { margin: 6px 0; padding-left: 18px; color: var(--text); }
.working-label { margin: 6px 0 3px; color: var(--muted); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.assistant-working pre { margin: 0; padding: 8px 10px; border-radius: 7px; background: #0f1e2c; color: #d6e4f0; font: 11.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.working-check { margin: 6px 0 0; color: #166534; font-size: 12px; }
.working-check::before { content: "✓ "; }

/* The assistant's live steps: a spinner while a step runs, then a tick (or a cross) */
.assistant-live { display: block; width: 100%; }
.assistant-activity { margin: 0 0 8px; font-size: 12.5px; }
.assistant-activity summary { display: flex; align-items: center; gap: 6px; cursor: pointer; color: var(--muted); font-weight: 600; list-style: none; }
.assistant-activity summary::-webkit-details-marker { display: none; }
.assistant-activity summary::before { content: "›"; display: inline-block; width: 8px; transition: transform .15s; }
.assistant-activity[open] summary::before { transform: rotate(90deg); }
.assistant-activity.live summary { color: var(--ink); }
.assistant-activity ol { position: relative; margin: 6px 0 0; padding: 0 0 0 4px; list-style: none; display: grid; gap: 6px; }
.assistant-activity li { display: grid; grid-template-columns: 16px 1fr; gap: 8px; align-items: start; animation: act-in .18s ease-out; }
.act-icon { width: 14px; height: 14px; margin-top: 2px; border-radius: 50%; display: grid; place-items: center; font-size: 9px; font-weight: 800; color: #fff; }
li[data-state="running"] .act-icon { border: 2px solid var(--line); border-top-color: var(--accent); animation: act-spin .7s linear infinite; }
li[data-state="done"] .act-icon { background: #16a34a; }
li[data-state="done"] .act-icon::before { content: "✓"; }
li[data-state="failed"] .act-icon { background: #dc2626; }
li[data-state="failed"] .act-icon::before { content: "×"; font-size: 11px; }
.act-body { display: grid; gap: 2px; min-width: 0; }
.act-text { color: var(--text); line-height: 1.4; }
li[data-state="running"] .act-text { color: var(--ink); font-weight: 600; }
.act-detail { justify-self: start; max-width: 100%; padding: 2px 6px; border-radius: 5px; background: var(--bg); color: var(--muted); font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
@keyframes act-spin { to { transform: rotate(360deg); } }
@keyframes act-in { from { opacity: 0; transform: translateY(2px); } }
@media (prefers-reduced-motion: reduce) { li[data-state="running"] .act-icon { animation-duration: 2s; } .assistant-activity li { animation: none; } }

/* Why is this place this colour? */
.explain-popup { min-width: 250px; }
.explain-popup strong { display: flex; align-items: center; gap: 7px; }
.explain-swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.explain-summary { margin: 4px 0 8px; color: var(--text); font-size: 12.5px; }
.explain-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.explain-table td { padding: 3px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.explain-table td:first-child { color: var(--muted); }
.explain-table td:nth-child(2) { color: var(--ink); }
.explain-table tr.out td { background: #fef2f2; }
.explain-score { text-align: right; font-weight: 700; white-space: nowrap; }
.explain-score.s4 { color: #166534; } .explain-score.s3 { color: #4d7c0f; } .explain-score.s2 { color: #b45309; }
.explain-score.s1 { color: #c2410c; } .explain-score.s0 { color: #b91c1c; } .explain-score.sx { color: var(--muted); }
.explain-foot { margin: 6px 0 0; color: var(--muted); font-size: 11.5px; }
.explain-wait { margin: 0; color: var(--muted); }
.report-warnings { margin: 10px 0 4px; padding: 10px 12px; border: 1px solid #fde68a; border-radius: 9px; background: #fffbeb; color: #78350f; font-size: 13px; }
.report-warnings strong { display: block; margin-bottom: 4px; color: #92400e; }
.report-warnings ul { margin: 0; padding-left: 18px; }
.report-provenance { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11.5px; }

/* My files */
.files-dialog { width: min(720px, calc(100vw - 32px)); height: min(620px, calc(100vh - 48px)); max-height: none; }
.files-card { height: 100%; display: flex; flex-direction: column; }
.files-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 20px 6px 24px; }
.files-tools .search-box { flex: 1 1 260px; }
.files-own { display: flex; align-items: center; gap: 6px; color: var(--text); font-size: 13px; }
.files-usage { margin: 0; padding: 0 24px 8px; color: var(--muted); font-size: 12.5px; }
.files-list { flex: 1; min-height: 0; overflow: auto; margin: 0; padding: 0 12px 14px; list-style: none; }
.files-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.files-list li:hover { background: #fafbfc; }
.files-text { min-width: 0; display: grid; gap: 2px; }
.files-text strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--ink); font-size: 14px; }
.files-text small { color: var(--muted); font-size: 12px; }
.files-list button { flex: none; }
.files-empty { justify-content: center !important; color: var(--muted); }

/* A button whose action has started: a small spinning circle before its words */
.is-busy { cursor: progress !important; opacity: 1 !important; }
.is-busy::before { content: ""; display: inline-block; flex: none; width: 13px; height: 13px; margin-right: 8px; vertical-align: -2px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: busy-spin .7s linear infinite; }
.icon-btn.is-busy::before, .send-button.is-busy::before { margin-right: 0; }
@keyframes busy-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .is-busy::before { animation-duration: 1.8s; } }

/* The guided tour (tour.js): a ring round the button, and a short card beside it */
.tour-overlay { position: fixed; inset: 0; z-index: 9000; pointer-events: none; }
.tour-ring { position: fixed; border-radius: 12px; border: 3px solid #3498db; box-shadow: 0 0 0 9999px rgba(19, 41, 61, .35); transition: all .2s ease; pointer-events: none; }
.tour-card { position: fixed; width: min(320px, calc(100vw - 24px)); padding: 16px 18px; border-radius: 14px; background: #fff; color: #13293d; box-shadow: 0 18px 40px rgba(19, 41, 61, .25); pointer-events: auto; }
.tour-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.tour-count { color: #627384; font-size: 12px; font-weight: 700; letter-spacing: .03em; }
.tour-skip { border: 0; background: none; color: #2477b3; font-size: 12px; cursor: pointer; padding: 2px 4px; }
.tour-title { margin: 0 0 6px; font: 700 17px/1.25 "Manrope", "DM Sans", sans-serif; }
.tour-text { margin: 0 0 14px; font-size: 14px; line-height: 1.5; color: #22374a; }
.tour-actions { display: flex; justify-content: flex-end; gap: 8px; }
.tour-actions button { min-height: 34px; padding: 0 14px; border-radius: 9px; border: 1px solid #d6e2ec; background: #fff; color: #22374a; font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.tour-actions button:disabled { opacity: .4; cursor: default; }
.tour-actions .tour-primary { background: #2477b3; border-color: #2477b3; color: #fff; }
