/* Dyaan workspace shell: ribbon / contents / map / geoprocessing / table / status bar. */

.app-body {
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) 210px 30px;
  background: var(--bg-deep);
  overflow: hidden;
}

/* ── top ribbon ───────────────────────────────────────────────────────────── */
.ribbon {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 10px 16px;
  background: var(--glass);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: var(--glass-inset);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.ribbon-group { display: flex; flex-direction: column; gap: 5px; padding-left: 20px; border-left: 1px solid var(--glass-border); }
.ribbon-tools { display: flex; align-items: center; gap: 7px; }
.ribbon-user { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.search { display: flex; gap: 6px; }
.dy-input-sm { padding: 6px 10px; font-size: 13px; width: 190px; }
.dy-btn.is-active { border-color: rgba(123, 165, 245, .55); color: var(--text-heading); box-shadow: var(--glass-inset), 0 0 0 1px rgba(123, 165, 245, .25); }

/* ── workspace grid ───────────────────────────────────────────────────────── */
.workspace { display: grid; grid-template-columns: 268px minmax(0, 1fr) 320px; gap: 10px; padding: 10px; min-height: 0; }

.pane { padding: 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.pane-title { color: var(--text-heading); font-size: 15px; }
.pane-block { display: flex; flex-direction: column; gap: 9px; }

.layer { display: flex; align-items: center; gap: 8px; color: var(--text-body); font-size: 13.5px; cursor: pointer; }
.layer input { accent-color: var(--accent-from); }
.chip-sm { width: 24px; height: 24px; border-radius: 8px; font-size: 12px; }

.aoi-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; font-size: 13.5px; }
.aoi-list li { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); }
.aoi-list button.aoi-open { background: none; border: 0; padding: 0; color: var(--accent-from); font-family: var(--font-ui); font-size: 13.5px; cursor: pointer; text-align: left; }
.aoi-list button.aoi-del { background: none; border: 0; color: var(--text-muted); cursor: pointer; margin-left: auto; }
.aoi-list button.aoi-del:hover { color: var(--rose); }
.aoi-readout { font-size: 12.5px; word-break: break-all; }

/* ── map ──────────────────────────────────────────────────────────────────── */
.map-wrap { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--glass-border); box-shadow: var(--glass-inset); min-height: 0; }
#map { position: absolute; inset: 0; background: #0a1020; }

.map-hud {
  position: absolute;
  left: 12px;
  bottom: 12px;
  right: 12px;
  max-width: 560px;
  padding: 10px 13px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-size: 12.5px;
}

.maplibregl-ctrl-group { background: rgba(10, 16, 32, .82) !important; border: 1px solid var(--glass-border) !important; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--glass-border) !important; }
.maplibregl-ctrl-attrib { background: rgba(8, 11, 18, .7) !important; color: var(--text-muted) !important; }
.maplibregl-ctrl-attrib-inner, .maplibregl-ctrl-attrib-inner a, .maplibregl-ctrl-attrib a { color: var(--text-muted) !important; }
.maplibregl-ctrl-attrib a:hover { color: var(--text-secondary) !important; }
.maplibregl-ctrl-attrib-button { filter: invert(1) opacity(.7); }
.maplibregl-ctrl-scale { color: var(--text-secondary) !important; background: rgba(8, 11, 18, .5) !important; border: 1px solid var(--glass-border) !important; border-top: none !important; }
.maplibregl-popup-content { background: #0c1220 !important; border: 1px solid var(--glass-border); border-radius: var(--radius-sm); color: var(--text-body); font-family: var(--font-mono); font-size: 12px; }
.maplibregl-popup-tip { border-top-color: #0c1220 !important; }
.map-drawing #map { cursor: crosshair; }

/* Metric cells are shared with the account/landing pages, so they live in tokens.css. */

/* ── attribute table ──────────────────────────────────────────────────────── */
.table-dock { margin: 0 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.table-head { display: flex; align-items: center; gap: 14px; }
.table-tabs { display: flex; gap: 7px; }
.table-head .dy-label { margin-left: auto; }
.table-scroll { overflow: auto; min-height: 0; }

.attr-table { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.attr-table th { text-align: left; padding: 7px 10px; position: sticky; top: 0; background: #0b0f18; border-bottom: 1px solid var(--glass-border); white-space: nowrap; }
.attr-table td { padding: 6px 10px; color: var(--text-body); border-bottom: 1px solid rgba(255, 255, 255, .045); white-space: nowrap; }
.attr-table tbody tr:hover td { background: rgba(255, 255, 255, .035); }

/* ── status bar ───────────────────────────────────────────────────────────── */
.statusbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 16px;
  background: var(--glass);
  border-top: 1px solid var(--glass-border);
  box-shadow: var(--glass-inset);
}
.statusbar .status-right { margin-left: auto; }

@media (max-width: 1280px) {
  .workspace { grid-template-columns: 232px minmax(0, 1fr) 290px; }
  .dy-input-sm { width: 140px; }
}

/* ── AI chat panel ────────────────────────────────────────────────────────── */
.chat-panel {
  position: fixed; right: 18px; bottom: 74px; width: 372px; max-height: 62vh;
  display: flex; flex-direction: column; z-index: 60; overflow: hidden;
  background: rgba(8, 11, 18, .97); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
}
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; border-bottom: 1px solid var(--glass-border); }
.chat-actions { display: flex; align-items: center; gap: 2px; }
.chat-close, .chat-min { background: none; border: 0; color: var(--text-secondary); font-size: 20px; line-height: 1; cursor: pointer; width: 26px; height: 26px; border-radius: 7px; }
.chat-close:hover, .chat-min:hover { color: var(--text-heading); background: rgba(255, 255, 255, .06); }
.chat-panel.minimized .chat-log, .chat-panel.minimized .chat-form { display: none; }
.chat-panel.minimized { max-height: none; }
.chat-head { cursor: default; }
.chat-log { flex: 1; overflow-y: auto; padding: 13px 14px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { padding: 9px 12px; border-radius: 13px; font-size: 13px; line-height: 1.55; max-width: 86%; white-space: pre-wrap; }
.chat-msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); }
.chat-msg.bot { align-self: flex-start; background: rgba(255, 255, 255, .05); border: 1px solid var(--glass-border); color: var(--text-body); }
.chat-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--glass-border); }
.chat-form .dy-input { flex: 1; }

/* ── vegetation change-over-time ─────────────────────────────────────────── */
.veg-change { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--glass-border); display: flex; flex-direction: column; gap: 8px; }
.veg-change-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.veg-change-row .dy-input-sm { width: 92px; }

/* ── layer manager ───────────────────────────────────────────────────────── */
.layer-row { display: flex; flex-direction: column; align-items: stretch; gap: 5px; margin-bottom: 6px; }
.layer-row .layer { white-space: normal; }
.layer-opacity { width: 100%; cursor: pointer; }

/* ── elevation profile panel ─────────────────────────────────────────────── */
.profile-panel { position: fixed; left: 18px; bottom: 74px; width: 520px; max-width: calc(100vw - 36px); z-index: 40; background: rgba(8, 11, 18, .97); border: 1px solid var(--glass-border); border-radius: 14px; box-shadow: 0 18px 50px rgba(0,0,0,.5); backdrop-filter: blur(18px); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.profile-panel[hidden] { display: none; }
.profile-head { display: flex; align-items: center; justify-content: space-between; }
.profile-chart { width: 100%; min-height: 150px; }
.profile-chart svg { display: block; width: 100%; height: auto; }

/* ── saved area rename control ───────────────────────────────────────────── */
.aoi-edit { background: transparent; border: none; color: var(--text-secondary); cursor: pointer; font-size: 12px; padding: 2px 4px; line-height: 1; }
.aoi-edit:hover { color: var(--text-heading); }

/* ── onboarding welcome ──────────────────────────────────────────────────── */
.onboard-overlay { position: fixed; inset: 0; z-index: 60; background: rgba(4, 6, 12, .72); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 24px; }
.onboard-overlay[hidden] { display: none; }
.onboard-card { width: 560px; max-width: 100%; background: rgba(10, 14, 22, .98); border: 1px solid var(--glass-border); border-radius: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.6); padding: 26px 28px; display: flex; flex-direction: column; gap: 12px; }
.onboard-title { font-size: 23px; line-height: 1.25; margin: 4px 0 2px; }
.onboard-sub { color: var(--text-secondary); font-size: 14px; line-height: 1.6; margin: 0; }
.onboard-list { list-style: none; margin: 6px 0 8px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.onboard-list li { color: var(--text-body); font-size: 14px; line-height: 1.55; }
.onboard-k { display: block; font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-from); margin-bottom: 2px; }
.onboard-card .dy-btn-lg { align-self: flex-start; margin-top: 4px; }

/* ── AI chat: open-full-report link ──────────────────────────────────────── */
.chat-report-link { display: inline-block; margin: 4px 0 2px; padding: 6px 12px; border-radius: 10px; background: rgba(123,165,245,.14); border: 1px solid rgba(123,165,245,.32); color: var(--accent-from); font-size: 13px; text-decoration: none; align-self: flex-start; }
.chat-report-link:hover { background: rgba(123,165,245,.24); }

/* ════════════════════════════════════════════════════════════════════════════
   REDESIGN — hub + analysis pages
   ════════════════════════════════════════════════════════════════════════════ */
.hub-body, .an-body { margin: 0; height: 100vh; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); color: var(--text-body); font-family: var(--font-ui); }

.hub-top { display: flex; align-items: center; gap: 16px; padding: 12px 20px; border-bottom: 1px solid var(--glass-border); background: rgba(8,11,18,.82); backdrop-filter: blur(16px); flex: none; }
.hub-top .dy-wordmark { display: inline-block; width: 116px; height: 28px; background: url("/brand/dyaan-lockup-light.png") left center / contain no-repeat; font-size: 0; color: transparent; text-decoration: none; }
.hub-top .dy-wordmark .mark { display: none; }
.hub-search { flex: 1; display: flex; gap: 8px; max-width: 620px; }
.hub-search .dy-input { flex: 1; }
.hub-topright { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.an-crumb { display: flex; align-items: center; gap: 10px; }

.hub-main, .an-main { flex: 1; display: flex; min-height: 0; }

/* left rail of category cards */
.hub-rail { width: 340px; flex: none; border-right: 1px solid var(--glass-border); padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; background: rgba(255,255,255,.012); }
.cat-rail { display: flex; flex-direction: column; gap: 9px; margin-top: 4px; }
.cat-card { display: flex; align-items: center; gap: 12px; text-align: left; padding: 13px 14px; border-radius: 13px; border: 1px solid var(--glass-border); background: var(--glass); color: var(--text-body); cursor: pointer; transition: transform .12s ease, border-color .12s ease, background .12s ease; }
.cat-card:hover { transform: translateY(-1px); border-color: var(--border-strong, rgba(255,255,255,.2)); background: rgba(255,255,255,.05); }
.cat-card .cat-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--accent, #888); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent, #888) 22%, transparent); }
.cat-card .cat-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.cat-card .cat-label { font-weight: 600; font-size: 14.5px; color: var(--text-heading); }
.cat-card .cat-desc { font-size: 12px; color: var(--text-secondary); }
.cat-card .cat-arrow { color: var(--text-muted); font-size: 16px; transition: transform .12s ease; }
.cat-card:hover .cat-arrow { transform: translateX(3px); color: var(--text-heading); }
.hub-saved { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--glass-border); }

/* map area */
.hub-map-wrap, .an-map { position: relative; flex: 1; min-width: 0; }
.hub-map-wrap #map, .an-map #map { position: absolute; inset: 0; background: #0a1020; }
.map-toolbar { position: absolute; top: 14px; left: 14px; z-index: 5; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; max-width: calc(100% - 28px); padding: 8px 10px; border-radius: 13px; background: rgba(8,11,18,.9); border: 1px solid var(--glass-border); backdrop-filter: blur(14px); }
.map-toolbar .dy-input-sm { width: 190px; }
.hub-aoibar { position: absolute; left: 14px; bottom: 40px; z-index: 5; max-width: calc(100% - 28px); }
.aoi-readout { margin: 0; padding: 8px 12px; border-radius: 11px; background: rgba(8,11,18,.9); border: 1px solid var(--glass-border); font-family: var(--font-mono); font-size: 12px; color: var(--text-body); backdrop-filter: blur(10px); }
.hub-note { margin-top: 8px; padding: 8px 12px; border-radius: 11px; font-size: 13px; background: rgba(8,11,18,.9); border: 1px solid var(--glass-border); color: var(--text-secondary); backdrop-filter: blur(10px); }
.hub-note.is-error { color: var(--rose); border-color: rgba(255,107,138,.4); }
.hub-note.is-ok { color: var(--mint); border-color: rgba(95,227,200,.35); }

.statusbar { flex: none; display: flex; align-items: center; gap: 18px; padding: 7px 20px; border-top: 1px solid var(--glass-border); background: rgba(8,11,18,.82); font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }

/* analysis page */
.an-rail { width: 340px; flex: none; border-right: 1px solid var(--glass-border); padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; background: rgba(255,255,255,.012); }
.an-title { font-size: 24px; margin: 2px 0; }
.an-sub { color: var(--text-secondary); font-size: 13px; line-height: 1.5; margin: 0 0 6px; }
.an-controls { display: flex; flex-direction: column; gap: 10px; padding: 12px 0; border-top: 1px dashed var(--glass-border); border-bottom: 1px dashed var(--glass-border); }
.an-ctl { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-secondary); }
.an-ctl-row { display: flex; align-items: center; gap: 8px; }
.an-chks { display: flex; gap: 12px; font-size: 13px; color: var(--text-body); }
.an-chks label { display: flex; align-items: center; gap: 5px; }
.an-search { display: flex; flex-direction: column; gap: 5px; }

.an-content { flex: 1; min-width: 0; overflow-y: auto; padding: 18px 22px 60px; }
.an-content .an-map { position: relative; height: clamp(320px, 46vh, 560px); border-radius: 14px; overflow: hidden; border: 1px solid var(--glass-border); margin-bottom: 16px; }
/* KPI cards are shared with the report page, so they live in tokens.css. */
.an-kpis { margin-bottom: 16px; }
.an-section { background: rgba(255,255,255,.02); border: 1px solid var(--glass-border); border-radius: 16px; padding: 16px 18px; margin-bottom: 16px; }
.an-tblhead { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.an-tblhead h2 { font-size: 17px; margin: 0; }
.an-count { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.an-tblscroll { overflow-x: auto; }
.an-foot { color: var(--text-muted); font-size: 12px; line-height: 1.7; margin-top: 20px; }

/* shared table used on analysis + report pages */
table.rpt { width: 100%; border-collapse: collapse; font-size: 13px; }
table.rpt th, table.rpt td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--glass-border); white-space: nowrap; }
table.rpt th { color: var(--text-muted); font-family: var(--font-mono); font-size: 11px; letter-spacing: .07em; text-transform: uppercase; cursor: pointer; user-select: none; }
table.rpt th:hover { color: var(--text-heading); }
table.rpt td.num { text-align: right; font-family: var(--font-mono); }
table.rpt tr:hover td { background: rgba(255,255,255,.03); }
.rpt-note { color: var(--text-secondary); font-size: 13px; }

@media print { .hub-top, .an-top, .an-rail, .map-toolbar { display: none !important; } .an-content { overflow: visible; } body { background: #fff; color: #000; } }

/* ── rich analysis map controls + charts ─────────────────────────────────── */
.map-basemaps { position: absolute; top: 12px; left: 12px; z-index: 6; display: flex; gap: 4px; padding: 4px; border-radius: 11px; background: rgba(8,11,18,.9); border: 1px solid var(--glass-border); backdrop-filter: blur(12px); }
.bm-btn { padding: 5px 10px; border-radius: 8px; border: none; background: transparent; color: var(--text-secondary); font-size: 12px; cursor: pointer; font-family: var(--font-ui); }
.bm-btn:hover { color: var(--text-heading); }
.bm-btn.is-active { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.map-coord { position: absolute; bottom: 10px; right: 12px; z-index: 6; padding: 4px 9px; border-radius: 8px; background: rgba(8,11,18,.85); border: 1px solid var(--glass-border); font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary); }
.map-legend { position: absolute; bottom: 40px; left: 12px; z-index: 6; display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; background: rgba(8,11,18,.92); border: 1px solid var(--glass-border); font-size: 11px; color: var(--text-secondary); }
.map-legend .lg-t { font-family: var(--font-mono); letter-spacing: .08em; color: var(--text-muted); }
.map-legend .lg-ramp { width: 64px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, #FF9E6B, #FF6B3D, #FF6B8A); }
/* Legend for a painted raster: one chip per class, in the class's own colour, clickable to isolate
   those pixels on the map. */
.map-legend { max-width: calc(100% - 24px); flex-wrap: wrap; }
.map-legend .lg-chips { display: flex; flex-wrap: wrap; gap: 4px 6px; max-width: 460px; }
.map-legend .lg-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px 3px 6px; border-radius: 999px; border: 1px solid var(--glass-border); background: rgba(255,255,255,.03); color: var(--text-body); font: inherit; font-size: 11px; cursor: pointer; transition: background .14s ease, border-color .14s ease; }
.map-legend .lg-chip:hover { background: rgba(255,255,255,.09); border-color: rgba(255,255,255,.2); }
.map-legend .lg-chip.is-on { border-color: var(--accent-from); background: rgba(123,165,245,.16); color: var(--text-heading); }
.map-legend .lg-sw, .tbl-sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.35); }
.tbl-sw { margin-right: 8px; vertical-align: -1px; }
.map-legend .lg-ramp2 { display: flex; width: 96px; height: 8px; border-radius: 4px; overflow: hidden; }
.map-legend .lg-ramp2 i { flex: 1; }
.map-legend .lg-l { color: var(--text-muted); font-size: 10.5px; }
.an-chartwrap { }
.chart-box { position: relative; height: 260px; }

/* Utility classes that replace inline style attributes, which the Content-Security-Policy forbids. */
.onboard-title { color: var(--text-heading); }
.is-push-right { margin-left: auto; }
.is-fullwidth { width: 100%; }
.is-err { color: var(--rose); }
.an-section h2 { color: var(--text-heading); }
.an-tblhead h2 { color: var(--text-heading); }
.dy-btn.is-locked { opacity: .5; cursor: not-allowed; }

/* ── Ask Dyaan (natural-language → the right analysis) ─────────────────────────── */
.hub-ask { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: var(--radius); background: var(--glass); border: 1px solid var(--glass-border); box-shadow: var(--glass-inset); }
.ask-form { display: flex; gap: 6px; }
.ask-form .dy-input { flex: 1 1 auto; min-width: 0; }
.ask-result { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.ask-answer { margin: 0; font-family: var(--font-ui); font-size: 13.5px; line-height: 1.5; color: var(--text-body); white-space: pre-wrap; }
.ask-answer.is-thinking { color: var(--text-muted); font-style: italic; }
.ask-answer.is-error { color: var(--rose); }
.ask-open { align-self: flex-start; text-decoration: none; }

/* ── Watchlist & alert feed ────────────────────────────────────────────────────── */
.watch-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.watch-row { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--glass); border: 1px solid var(--glass-border); }
.watch-row .watch-head { display: flex; align-items: center; gap: 8px; }
.watch-name { font-family: var(--font-ui); font-size: 13.5px; color: var(--text-heading); font-weight: 600; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; background: none; border: 0; text-align: left; padding: 0; }
.watch-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.watch-chip { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .02em; padding: 2px 7px; border-radius: 999px; background: rgba(255,255,255,.05); border: 1px solid var(--glass-border); color: var(--text-secondary); }
.watch-chip.is-hot { color: var(--fire); border-color: rgba(255,107,61,.4); }
.watch-meta { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.watch-actions { display: flex; gap: 6px; }
.watch-mini { background: none; border: 0; padding: 0 2px; cursor: pointer; color: var(--accent-from); font-family: var(--font-mono); font-size: 11px; }
.watch-mini.is-del { color: var(--text-muted); }
.watch-feed { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--glass-border); display: flex; flex-direction: column; gap: 5px; }
.feed-item { font-family: var(--font-ui); font-size: 12.5px; line-height: 1.45; color: var(--text-secondary); padding-left: 10px; border-left: 2px solid var(--glass-border); }
.feed-item.is-alert { border-left-color: var(--fire); color: var(--text-body); }
.feed-item.is-warn { border-left-color: var(--mint); }
.feed-when { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); }

/* ── Responsive: phones & small tablets ───────────────────────────────────────── */
@media (max-width: 820px) {
  /* headers wrap; search drops to its own full-width row */
  .hub-top, .an-top { flex-wrap: wrap; padding: 10px 14px; gap: 10px; }
  .hub-search { order: 3; flex-basis: 100%; max-width: none; }
  .hub-topright { margin-left: 0; flex-wrap: wrap; }

  /* hub on phones: the MAP is the product, so it leads with a real height; the analyses list
     scrolls beneath it. Uses dvh so the mobile browser chrome doesn't crush the map. */
  .hub-body { height: 100dvh; }
  .hub-insights { display: none; }
  .hub-main { flex-direction: column; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .hub-map-wrap { order: -1; flex: none; height: 62vh; min-height: 340px; border-bottom: 1px solid var(--glass-border); }
  .hub-rail { width: 100%; max-height: none; overflow: visible; flex: none; border-right: 0; border-bottom: 0; }

  /* analysis / report: let the page scroll and stack the rail above the content */
  .an-body { height: auto; min-height: 100vh; overflow: auto; }
  .an-main { flex-direction: column; }
  .an-rail { width: 100%; border-right: 0; border-bottom: 1px solid var(--glass-border); }
  .an-content { overflow: visible; padding: 14px 14px 48px; }
  .an-content .an-map { height: clamp(240px, 42vh, 420px); }

  /* toolbars and their inputs fit a narrow screen instead of overflowing */
  .map-toolbar { left: 8px; top: 8px; gap: 6px; padding: 7px 8px; max-width: calc(100% - 16px); }
  .map-toolbar .dy-input-sm, .map-toolbar .dy-input { width: 100%; flex: 1 1 130px; }

  /* legacy grid + floating chat degrade to a single column */
  .workspace { grid-template-columns: 1fr; }
  .chat-panel { right: 8px; left: 8px; width: auto; max-height: 70vh; }

  /* wide data tables scroll horizontally rather than break the layout */
  .an-results table, #an-results table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* live readout beside a range slider */
.an-ctl-out { font-family: var(--font-mono); font-size: 12px; color: var(--text-heading); min-width: 34px; text-align: right; }

/* in-app name modal (replaces window.prompt) */
.name-card { width: 380px; max-width: 100%; gap: 14px; }
.name-modal-actions { display: flex; gap: 8px; margin-top: 2px; }
/* the analysis category picker must fit its longest option ("Climate & rainfall") */
#cat-jump { min-width: 172px; }

/* progress spinner for slow reads */
@keyframes dy-spin { to { transform: rotate(360deg); } }
.an-spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--glass-border); border-top-color: var(--accent-from); border-radius: 50%; animation: dy-spin .8s linear infinite; vertical-align: -2px; }
.an-loading { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 14px; padding: 18px 2px; }

/* once results are on screen, the Run button steps back so the data is the focus */
#an-run.is-rerun { background: transparent; color: var(--text-body); border: 1px solid var(--glass-border); box-shadow: none; font-size: 13px; padding: 9px 14px; align-self: flex-start; }
#an-run.is-rerun:hover { border-color: var(--accent-from); color: var(--text-heading); }

/* Compare areas */
.hub-saved-head { display: flex; align-items: center; justify-content: space-between; }
.cmp-link { font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em; color: var(--accent-from); text-decoration: none; }
.cmp-link:hover { color: var(--text-heading); }
.cmp-wrap { max-width: 980px; }
.cmp-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0 18px; }
.cmp-progress { font-size: 12px; }

/* encroachment verdict banner */
.enc-verdict { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 15px; font-weight: 500; }
.enc-verdict.is-alert { background: rgba(255,107,61,.14); border: 1px solid rgba(255,107,61,.42); color: var(--fire); }
.enc-verdict.is-warn { background: rgba(255,255,255,.05); border: 1px solid var(--glass-border); color: var(--text-heading); }
.enc-verdict.is-ok { background: rgba(95,227,200,.1); border: 1px solid rgba(95,227,200,.35); color: var(--mint); }

/* ── homescreen field-notes slider ────────────────────────────────────────── */
.hub-insights { padding: 10px 16px 4px; border-bottom: 1px solid var(--glass-border); background: rgba(255,255,255,.015); }
.hi-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.hi-head .hi-all { color: var(--accent-from); text-decoration: none; font-size: 12.5px; }
.hi-head .hi-all:hover { color: var(--text-heading); }
.hi-slider { display: flex; align-items: stretch; gap: 8px; }
.hi-track { display: flex; gap: 14px; overflow-x: auto; scroll-behavior: smooth; scrollbar-width: none; flex: 1; }
.hi-track::-webkit-scrollbar { display: none; }
.hi-card { flex: 0 0 320px; max-width: 320px; display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--glass-border); background: var(--glass); text-decoration: none; transition: border-color .16s; }
.hi-card:hover { border-color: rgba(123,165,245,.5); }
.hi-topic { color: var(--accent-from); }
.hi-title { color: var(--text-heading); font-size: 14.5px; line-height: 1.25; font-weight: 600; }
.hi-headline { font-family: var(--font-mono); font-size: 12px; color: var(--mint); }
.hi-place { color: var(--text-muted); font-size: 11.5px; }
.hi-arrow { flex: 0 0 auto; width: 30px; border-radius: var(--radius-sm); border: 1px solid var(--glass-border); background: var(--glass); color: var(--text-secondary); cursor: pointer; font-size: 18px; line-height: 1; }
.hi-arrow:hover { color: var(--text-heading); border-color: rgba(123,165,245,.5); }
@media (max-width: 720px) { .hi-card { flex-basis: 250px; } .hi-arrow { display: none; } }

.is-loading { opacity: .55; }

/* In-between widths (laptop-with-sidebar / half-screen): keep the floating map toolbar to one
   scrollable row so it no longer wraps over the top third of the map and hides place labels. */
@media (min-width: 821px) and (max-width: 1024px) {
  .map-toolbar { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; max-width: calc(100% - 28px); scrollbar-width: none; }
  .map-toolbar::-webkit-scrollbar { display: none; }
  .map-toolbar .dy-input-sm { width: 150px; flex: 0 0 auto; }
}

/* ── Dyaan Score card ─────────────────────────────────────────────────────── */
.score-card { display: flex; gap: 18px; align-items: center; padding: 16px 18px; margin-bottom: 16px; border-radius: var(--radius); border: 1px solid var(--glass-border); background: var(--glass); box-shadow: var(--glass-inset); }
.sc-meta { flex: 1; }
.sc-ringwrap { position: relative; width: 74px; height: 74px; flex: 0 0 auto; }
.sc-ring { width: 74px; height: 74px; transform: rotate(-90deg); }
.sc-ring .sc-track { fill: none; stroke: rgba(255,255,255,.10); stroke-width: 4; }
.sc-ring .sc-arc { fill: none; stroke-width: 4; stroke-linecap: round; }
.sc-num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; font-family: var(--font-mono); font-weight: 700; font-size: 22px; color: var(--text-heading); }
.sc-num span { font-size: 8px; font-weight: 600; color: var(--text-muted); margin-top: 2px; letter-spacing: .4px; }
.sc-meta { min-width: 0; }
.sc-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.sc-grade { font-family: var(--font-mono); font-weight: 700; font-size: 15px; }
.sc-label { color: var(--text-heading); font-size: 15px; font-weight: 600; }
.sc-ind { color: var(--text-muted); font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; }
.sc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 6px; }
.sc-chip { font-size: 12px; color: var(--text-secondary); background: rgba(255,255,255,.04); border: 1px solid var(--glass-border); border-radius: 999px; padding: 3px 9px; }
.sc-chip b { color: var(--text-heading); font-weight: 600; }
.sc-note { color: var(--text-muted); font-size: 11.5px; margin: 0; }
/* tier colours: A mint → E red */
.sc-a .sc-arc { stroke: #5FE3C8; } .sc-a .sc-grade { color: #5FE3C8; }
.sc-b .sc-arc { stroke: #9BE86B; } .sc-b .sc-grade { color: #9BE86B; }
.sc-c .sc-arc { stroke: #F5C15F; } .sc-c .sc-grade { color: #F5C15F; }
.sc-d .sc-arc { stroke: #F59E5F; } .sc-d .sc-grade { color: #F59E5F; }
.sc-e .sc-arc { stroke: #FF6B6B; } .sc-e .sc-grade { color: #FF6B6B; }

/* ── time machine slider ──────────────────────────────────────────────────── */
.timeline { margin: 12px 0 6px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--glass-border); background: var(--glass); box-shadow: var(--glass-inset); }
.tl-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.tl-readout { color: var(--text-heading); font-size: 13px; }
.tl-slider { width: 100%; accent-color: var(--mint); cursor: pointer; }
.tl-ticks { display: flex; justify-content: space-between; margin-top: 4px; }
.tl-tick { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.tl-tick.is-now { color: var(--mint); }
.tl-spark { width: 100%; height: 46px; margin-top: 10px; display: block; }
.tl-summary { margin-top: 8px; color: var(--text-secondary); }
.tl-load-btn { margin-top: 10px; }
.tl-load-btn:disabled { opacity: .6; }

/* ── AI / auto summary ────────────────────────────────────────────────────── */
.sc-sum-btn { margin-top: 8px; }
.an-summary { margin-top: 10px; padding: 11px 13px; border-radius: var(--radius-sm); border: 1px solid rgba(123,165,245,.3); background: rgba(123,165,245,.07); color: var(--text-body); font-size: 14px; line-height: 1.55; }
.an-summary .sum-src { display: inline-block; margin-left: 6px; font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); }
.an-summary .is-err { color: var(--rose); }

/* Live "where the analysis is reading" panel (left rail, during a run) */
.an-runloc { margin: 10px 0 0; padding: 10px 12px; border: 1px solid var(--glass-border); border-radius: 10px; background: rgba(123,165,245,.06); font-size: 12px; color: var(--text-secondary); display: flex; flex-direction: column; gap: 3px; }
.an-runloc .rl-t { color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; font-size: 10.5px; }
.an-runloc .rl-c { color: var(--text-heading); font-family: var(--font-mono); font-size: 14px; font-weight: 600; }
.an-runloc .rl-b { color: var(--text-muted); font-family: var(--font-mono); font-size: 10.5px; }
.an-runloc .an-spinner { margin-bottom: 2px; }

/* Home command-search: pulse the matched analysis tile when an intent has no area yet */
@keyframes catPulse { 0%,100%{ box-shadow:0 0 0 0 rgba(123,165,245,0); } 30%{ box-shadow:0 0 0 3px rgba(123,165,245,.55); } }
.cat-card.cat-pulse { animation: catPulse 1.3s ease-in-out 2; border-color: rgba(123,165,245,.6); }
