:root {
  --bg: #f6f7f3; --panel: #ffffff; --ink: #1d2a1f; --muted: #5d6b60; --line: #e1e6df;
  --green: #2f7d3b; --green-2: #e7f3e8; --amber: #b7791f; --amber-2: #fdf3e1; --red: #b23a3a; --red-2: #fbeaea;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
button { font: inherit; cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 8px; padding: 7px 12px; }
button:hover:not(:disabled) { border-color: #b8c4b9; }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--green); color: #fff; border-color: var(--green); }
button.ghost { background: transparent; }
button.active { outline: 2px solid var(--green); outline-offset: 1px; }

.topbar { height: 56px; display: flex; align-items: center; gap: 16px; padding: 0 16px; background: #fff; border-bottom: 1px solid var(--line); }
.brand { text-decoration: none; color: inherit; font-weight: 700; font-size: 17px; white-space: nowrap; }
.brand small { font-weight: 500; color: var(--muted); font-size: 12px; margin-left: 4px; }
.logo { color: var(--green); }
.search { flex: 1; display: flex; gap: 8px; max-width: 620px; }
.search-box { flex: 1; position: relative; display: flex; }
.suggestions { position: absolute; z-index: 1000; top: calc(100% + 4px); left: 0; right: 0; min-width: min(420px, 92vw); margin: 0; padding: 4px; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.12); max-height: 340px; overflow-y: auto; }
.suggestions li { padding: 7px 10px; border-radius: 6px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.suggestions li[aria-selected=true], .suggestions li:hover { background: var(--green-2); }
.suggestions li.head { cursor: default; color: var(--muted); font-size: 12px; background: none; padding-top: 4px; }
.suggestions .kind { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.search input { flex: 1; min-width: 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.search button { background: var(--ink); color: #fff; border-color: var(--ink); white-space: nowrap; }
.search .locate-icon-btn { background: #fff; color: var(--green); border-color: var(--line); padding: 7px 10px; font-size: 16px; line-height: 1; }
.search .locate-icon-btn:hover { border-color: var(--green); background: var(--green-2); }
.neutral-badge { font-size: 12px; color: var(--green); background: var(--green-2); padding: 4px 10px; border-radius: 99px; white-space: nowrap; }

.layout { display: grid; grid-template-columns: 1fr 420px; height: calc(100% - 56px); }
.mapwrap { position: relative; }
#map { position: absolute; inset: 0; }
.map-hint { position: absolute; z-index: 500; left: 50%; transform: translateX(-50%); bottom: 18px; background: rgba(20,30,22,.85); color: #fff; padding: 8px 14px; border-radius: 99px; font-size: 13px; white-space: nowrap; }

.panel { overflow-y: auto; background: var(--panel); border-left: 1px solid var(--line); padding: 14px 16px 24px; display: flex; flex-direction: column; gap: 12px; }
.tools { display: flex; gap: 6px; flex-wrap: wrap; }
.empty { color: var(--muted); margin: 0; }
.zones, #passages { display: flex; flex-direction: column; gap: 6px; }
.zone { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; display: grid; grid-template-columns: 14px 1fr auto; gap: 4px 8px; align-items: center; }
.zone .sw { width: 12px; height: 12px; border-radius: 3px; }
.zone input { border: 0; font: inherit; font-weight: 600; padding: 0; width: 100%; background: transparent; }
.zone .x { border: 0; padding: 0 4px; color: var(--muted); background: transparent; }
.zone .meta { grid-column: 2 / 4; color: var(--muted); font-size: 12.5px; }
.zone .meta b { color: var(--ink); font-weight: 600; }
.passage { font-size: 12.5px; color: var(--muted); }

.analyze { background: var(--ink); color: #fff; border-color: var(--ink); padding: 10px; font-weight: 600; }
.status { color: var(--muted); font-size: 12.5px; min-height: 1em; }
.status.err { color: var(--red); }

.summary { background: var(--bg); border-radius: var(--radius); padding: 12px; }
.summary h3, .filters h3 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stat { background: #fff; border-radius: 8px; padding: 8px 10px; }
.stat .v { font-size: 19px; font-weight: 700; }
.stat .l { font-size: 12px; color: var(--muted); }
.stat.warn .v { color: var(--amber); }
.stat.bad .v { color: var(--red); }
.notes { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; }

.filters label { display: block; margin-bottom: 6px; }
.filters input[type=range] { width: 100%; }
.filters .check { display: flex; gap: 6px; align-items: center; }

.headline { font-size: 16px; font-weight: 600; margin: 4px 0 8px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; }
.card.fit { border-left: 4px solid var(--green); }
.card.caution { border-left: 4px solid var(--amber); }
.card.nofit { border-left: 4px solid var(--red); opacity: .85; }
.card .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.card .name { font-weight: 700; }
.card .price { color: var(--muted); white-space: nowrap; }
.card .specs { color: var(--muted); font-size: 12.5px; margin: 2px 0 6px; }
.tags { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 4px; }
.tag { font-size: 11.5px; padding: 1px 7px; border-radius: 99px; background: var(--bg); color: var(--muted); }
.reasons { margin: 0; padding-left: 16px; font-size: 13px; }
.reasons li.ok { color: var(--green); }
.reasons li.warn { color: var(--amber); }
.reasons li.bad { color: var(--red); }
.card .why { font-size: 12px; color: var(--muted); margin-top: 6px; }

.foot { margin-top: auto; padding-top: 12px; color: var(--muted); font-size: 11.5px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 5px; }
.foot-links a { color: var(--muted); text-decoration: none; }
.foot-links a:hover { color: var(--green); text-decoration: underline; }
.foot-disclosure { font-size: 11px; opacity: .9; }
.hidden { display: none; }
.steep-marker { background: var(--red); color: #fff; border-radius: 99px; padding: 2px 7px; font-size: 11px; font-weight: 700; white-space: nowrap; box-shadow: 0 1px 4px rgba(0,0,0,.4); border: 2px solid #fff; }
.zone-label { background: transparent; border: 0; box-shadow: none; color: #fff; font-weight: 700; text-shadow: 0 1px 3px #000; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: 55vh auto; height: auto; }
  .mapwrap { height: 55vh; }
  .neutral-badge, .brand small { display: none; }
  .map-hint { white-space: normal; width: 90%; text-align: center; }
}

@media (max-width: 640px) {
  .topbar { height: auto; flex-wrap: wrap; padding: 10px 12px; gap: 8px 12px; }
  .topbar .search { order: 3; flex: 1 0 100%; max-width: none; }
  .topbar .help-link { margin-left: auto; }
}

.help-link { font-size: 13px; color: var(--green); white-space: nowrap; }
