/* Lodeline Web (owner console map page) — layers over admin.css brand tokens. */

.webapp, .webapp-shell { height: 100vh; }
.webapp { overflow: hidden; }
.webapp-shell { display: flex; flex-direction: column; }

.webapp .topbar { flex: 0 0 auto; }
.webapp .topbar .brand { margin-right: auto; }
.back-link { text-decoration: none; }
#coord-btn { font-family: var(--font-mono); font-size: .8125rem; }

.stage { position: relative; flex: 1 1 auto; min-height: 0; }
#map { position: absolute; inset: 0; background: #0A0B0D; }

/* Center crosshair — the scan target. Pointer-events off so the map still pans under it. */
.crosshair {
  position: absolute; left: 50%; top: 50%; width: 26px; height: 26px;
  transform: translate(-50%, -50%); pointer-events: none; z-index: 5;
}
.crosshair::before, .crosshair::after {
  content: ""; position: absolute; background: var(--gold);
  box-shadow: 0 0 3px rgba(0,0,0,.9);
}
.crosshair::before { left: 50%; top: 0; bottom: 0; width: 2px; transform: translateX(-50%); }
.crosshair::after { top: 50%; left: 0; right: 0; height: 2px; transform: translateY(-50%); }

/* ---- floating panels ---- */
.panel { position: absolute; z-index: 10; padding: 14px; }

.layers-panel {
  top: 14px; left: 14px; width: 290px; max-height: calc(100% - 28px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
}
.layers-panel h2 {
  font-size: .6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin-top: 6px;
}
.layers-panel h2:first-child { margin-top: 0; }
.field { font-size: .75rem; color: var(--muted); display: flex; justify-content: space-between; }
#render-select { width: 100%; font-size: .8125rem; }

input[type="range"] { accent-color: var(--gold); width: 100%; padding: 0; background: transparent; border: 0; }

.overlay-list { display: flex; flex-direction: column; gap: 8px; }
.overlay-toggle {
  display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: baseline;
  cursor: pointer; padding: 4px 2px; border-radius: 8px;
}
.overlay-toggle:hover { background: var(--surface-2); }
.overlay-toggle input { accent-color: var(--gold); margin: 0; }
.ov-name { font-size: .8125rem; font-weight: 600; }
.ov-sub { grid-column: 2; font-size: .6875rem; color: var(--muted-2); line-height: 1.35; }
.zoom-hint { font-size: .75rem; color: var(--gold-bright); }

/* ---- scan ---- */
.scan-dock {
  position: absolute; z-index: 10; bottom: 22px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  width: min(380px, calc(100% - 28px));
}
.scan-btn { padding: 10px 26px; font-size: .9375rem; box-shadow: var(--shadow-card); }
.scan-card { position: static; width: 100%; display: flex; flex-direction: column; gap: 10px; }
.scan-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.scan-head h2 { font-size: .9375rem; }
.axis-sub { color: var(--muted-2); font-size: .75rem; font-weight: 500; }
.scan-status { font-size: .8125rem; color: var(--muted); }
.scan-status.err { color: var(--danger); }
.scan-result { display: flex; flex-direction: column; gap: 10px; }

/* Ring gauge — the web echo of the Android pill: combined score inside, band word beside. */
.scan-gauge-row { display: flex; align-items: center; gap: 14px; }
.gauge { position: relative; width: 84px; height: 84px; flex: 0 0 auto; }
.gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge circle { fill: none; stroke-width: 9; }
.gauge-track { stroke: var(--surface-3); }
.gauge-fill { stroke: currentColor; stroke-linecap: round; transition: stroke-dasharray .35s ease; }
.gauge .score-num {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 1.625rem; font-weight: 700; letter-spacing: -0.02em; color: var(--text);
}
.gauge-side { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.band-word {
  font-size: .875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: currentColor;
}
.axes-line { font-size: .8125rem; color: var(--muted); }
/* Band colors are SEMANTIC (never brand gold): LOW rose / MODERATE orange / HIGH green. */
.band-low  { color: var(--rose); }
.band-moderate { color: #FB923C; }
.band-high { color: #6CCB5F; }

/* Factor bars — same four factors as the Android breakdown sheet, 0..1 each. */
.factor-list { display: flex; flex-direction: column; gap: 6px; }
.factor {
  display: grid; grid-template-columns: 1fr 88px 34px; align-items: center; column-gap: 10px;
}
.factor-name { font-size: .75rem; color: var(--muted); }
.factor-track {
  height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden;
}
.factor-fill { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--gold); }
.factor-val { font-size: .75rem; color: var(--text); font-family: var(--font-mono); text-align: right; }

.covenant { font-size: .8125rem; font-weight: 700; color: var(--gold-bright); }
.scan-note { font-size: .75rem; color: var(--muted); line-height: 1.4; }
.attribution { font-size: .6875rem; color: var(--muted-2); }
.attribution:empty { display: none; }

/* ---- AI briefing panel ---- */
.ai-panel {
  top: 14px; right: 14px; bottom: 14px; width: min(420px, calc(100% - 28px));
  display: flex; flex-direction: column; gap: 10px;
}
.ai-head { display: flex; align-items: center; justify-content: space-between; }
.ai-head h2 { font-size: .9375rem; }
.ai-body { overflow-y: auto; flex: 1 1 auto; display: flex; flex-direction: column; gap: 10px; }
.ai-body p { font-size: .875rem; line-height: 1.55; }
.ai-body .ai-status { color: var(--muted); }
.ai-body .ai-error { color: var(--danger); }
.ai-footer {
  font-size: .75rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 8px;
}

/* ---- registered side panels (LW.registerPanel) + saved spots ---- */
.side-panel {
  top: 14px; right: 14px; bottom: 14px; width: min(360px, calc(100% - 28px));
  display: flex; flex-direction: column; gap: 10px;
}
.dock-row { display: flex; gap: 10px; }
.wp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wp-head h2 { font-size: .9375rem; }
.wp-toolbar { display: flex; gap: 8px; }
.wp-toolbar .btn { font-size: .75rem; padding: 5px 10px; }
.wp-list { flex: 1 1 auto; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.wp-item {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; cursor: pointer; color: var(--text); font-size: .8125rem;
}
.wp-item:hover { background: var(--surface-3); }
.wp-item .chip { flex: 0 0 auto; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wp-dot {
  width: 10px; height: 10px; border-radius: 999px; flex: 0 0 auto; display: inline-block;
  background: var(--surface-3); border: 1px solid var(--line-strong);
}
/* Band colors stay SEMANTIC (same as the scan card) — never brand gold. */
.wp-dot.band-high { background: #6CCB5F; border-color: #6CCB5F; }
.wp-dot.band-moderate { background: #FB923C; border-color: #FB923C; }
.wp-dot.band-low { background: var(--rose); border-color: var(--rose); }
.wp-name { flex: 1 1 auto; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wp-time { flex: 0 0 auto; font-size: .6875rem; color: var(--muted-2); }
.wp-empty { font-size: .8125rem; color: var(--muted); line-height: 1.5; padding: 8px 2px; }
.wp-detail { flex: 1 1 auto; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.wp-detail label { font-size: .75rem; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.wp-detail #wp-back { align-self: flex-start; }
.wp-coord { font-family: var(--font-mono); font-size: .75rem; color: var(--muted-2); }
.wp-score-line { font-size: .8125rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.wp-actions { display: flex; gap: 8px; flex-wrap: wrap; }
/* ---- AI suite (explain / area intel / trip planner) ---- */

/* Registered feature panels (LW.registerPanel) share the AI panel's right-rail geometry. */
.panel[data-panel] {
  top: 14px; right: 14px; bottom: 14px; width: min(420px, calc(100% - 28px));
  display: flex; flex-direction: column; gap: 10px;
}
.panel-body { overflow-y: auto; flex: 1 1 auto; display: flex; flex-direction: column; gap: 10px; }
.panel-body p { font-size: .875rem; line-height: 1.55; }
.panel-body .ai-status { color: var(--muted); }
.panel-body .ai-error { color: var(--danger); }

.scan-actions { display: flex; gap: 8px; }
.scan-actions .btn { flex: 1 1 0; }

.explain-btn { align-self: flex-start; font-size: .8125rem; }
.explain-out { font-size: .8125rem; line-height: 1.5; color: var(--text); white-space: pre-wrap; }
.explain-out.err { color: var(--danger); }
.explain-footer { font-size: .6875rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 6px; }

.spot-list, .leg-list, .plan-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.spot, .stop, .plan-item { display: grid; grid-template-columns: 1fr auto; column-gap: 8px; align-items: baseline; }
.spot-name { font-size: .875rem; font-weight: 600; }
.spot-coord { font-size: .6875rem; color: var(--muted-2); font-family: var(--font-mono); }
.spot-why, .leg-why { grid-column: 1 / -1; font-size: .8125rem; color: var(--muted); line-height: 1.45; }
.spot { border-left: 2px solid var(--gold); padding-left: 8px; }
.leg { padding-left: 14px; display: flex; flex-direction: column; gap: 2px; }
.leg-dist { font-size: .6875rem; color: var(--gold-bright); font-family: var(--font-mono); }
.day-summary { font-size: .875rem; line-height: 1.55; margin-top: 4px; }
.plan-item { grid-template-columns: 1fr auto auto; }
.plan-source { font-size: .8125rem; color: var(--muted); }
#plan-day { width: 100%; font-size: .8125rem; }
#plan-arm.armed { border-color: var(--gold); color: var(--gold-bright); }

/* MapLibre chrome on the dark theme */
.maplibregl-ctrl-attrib { background: rgba(20,17,11,.75) !important; color: var(--muted-2); font-size: 10px; }
.maplibregl-ctrl-attrib a { color: var(--muted); }

@media (max-width: 720px) {
  .layers-panel { width: min(260px, 70vw); }
  .ai-panel { top: auto; max-height: 55%; }
}

/* Shared bottom-left tools dock (LW.dock) — modules append buttons; no per-module corners. */
.lw-dock {
  position: absolute; z-index: 10; left: 14px; bottom: 22px;
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
}
.lw-dock .btn { box-shadow: var(--shadow-card); }

/* Basemap segmented control (Map | Satellite — Android Layers-sheet parity). */
.seg { display: flex; gap: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 10px; }
.seg-btn { flex: 1; padding: 6px 10px; background: transparent; border: 0; color: var(--muted); font: inherit; font-size: .8125rem; cursor: pointer; }
.seg-btn.on { background: rgba(224,165,42,.14); color: var(--gold-bright); }
