:root{
  --navy:#16324f; --teal:#0f766e; --gold:#b45309; --grey:#6b7280;
  --bg:#f6f7f9; --card:#ffffff; --line:#e5e7eb;
}
*{box-sizing:border-box}
html,body{margin:0;height:100%;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;color:#1f2937;background:var(--bg)}
body{display:flex;flex-direction:column;min-height:100vh}

.topbar{display:flex;justify-content:space-between;align-items:center;gap:16px;
  padding:12px 20px;background:var(--navy);color:#fff;flex-wrap:wrap}
.brand{display:flex;align-items:center;gap:12px}
.logo{width:38px;height:38px;border-radius:10px;background:var(--teal);display:flex;align-items:center;
  justify-content:center;font-weight:700;font-size:19px}
.topbar h1{font-size:17px;margin:0;font-weight:650;letter-spacing:.2px}
.topbar p{margin:2px 0 0;font-size:11.5px;color:#c7d2e0}
.topmeta{display:flex;gap:8px;flex-wrap:wrap}
.chip{font-size:11px;padding:4px 9px;border-radius:999px;background:rgba(255,255,255,.12);color:#e6edf5}
.chip.link{text-decoration:none;background:var(--teal)}
.chip.link:hover{background:#0d9488}

.layout{display:flex;flex:1;min-height:0}
.map-wrap{position:relative;flex:1;min-width:0;min-height:420px}
#map{position:absolute;inset:0}

.map-overlay{position:absolute;top:12px;left:12px;z-index:500;display:flex;flex-direction:column;gap:8px;max-width:270px}
.segmented{display:flex;background:#fff;border-radius:10px;box-shadow:0 2px 10px rgba(0,0,0,.15);overflow:hidden}
.segmented button{border:0;background:#fff;padding:7px 7px;font-size:11px;cursor:pointer;color:#374151;font-weight:600;flex:1;white-space:nowrap}
.segmented button+button{border-left:1px solid #eef0f3}
.segmented button.active{background:var(--navy);color:#fff}
.segmented.small button{padding:6px 8px;font-size:11px}

.legend{background:#fff;border-radius:10px;box-shadow:0 2px 10px rgba(0,0,0,.15);padding:8px 10px;font-size:11px}
.legend-title{font-weight:600;margin-bottom:4px;color:#374151}
.legend-bar{height:10px;border-radius:5px;margin:4px 0}
.legend-scale{display:flex;justify-content:space-between;color:var(--grey);gap:4px}
.legend-scale span{flex:1;font-size:9px;line-height:1.15;text-align:center}
.legend-scale span:first-child{text-align:left}
.legend-scale span:last-child{text-align:right}

.toggle{background:#fff;border-radius:8px;box-shadow:0 2px 8px rgba(0,0,0,.12);
  padding:6px 9px;font-size:11.5px;cursor:pointer;display:flex;gap:6px;align-items:center}
.map-note{font-size:9.5px;color:#4b5563;background:rgba(255,255,255,.85);padding:3px 6px;border-radius:6px}

.panel{width:400px;max-width:42vw;background:var(--card);border-left:1px solid var(--line);
  overflow-y:auto;padding:14px 16px 24px}
.section-title{font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.6px;
  color:var(--navy);margin:18px 0 8px;border-bottom:2px solid #eef2f7;padding-bottom:6px}
.section-title:first-child{margin-top:2px}
.hint{font-weight:400;text-transform:none;letter-spacing:0;color:var(--grey);font-size:10.5px}

.kpi{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.kpi .card{background:#f8fafc;border:1px solid #eef2f7;border-radius:10px;padding:9px 11px}
.kpi .v{font-size:20px;font-weight:700;color:var(--teal);line-height:1.1}
.kpi .l{font-size:10.5px;color:var(--grey);margin-top:2px}

.bars{display:flex;flex-direction:column;gap:6px}
.bar-row{display:grid;grid-template-columns:86px 1fr 32px;align-items:center;gap:6px;font-size:11.5px}
.bar-track{height:10px;background:#eef2f7;border-radius:5px;overflow:hidden}
.bar-fill{height:100%;background:var(--teal);border-radius:5px}
.bar-num{text-align:right;color:var(--grey);font-variant-numeric:tabular-nums}

.years{display:flex;align-items:flex-end;gap:5px;height:96px}
.year{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;gap:3px;height:100%}
.year .col{width:100%;background:#c2410c;border-radius:4px 4px 0 0;min-height:2px}
.year .n{font-size:10px;color:#374151;font-weight:600}
.year .y{font-size:9.5px;color:var(--grey)}

.zones{display:flex;flex-direction:column;gap:6px}
.zone{display:flex;justify-content:space-between;align-items:center;gap:8px;
  padding:7px 9px;border:1px solid #eef2f7;border-radius:9px;font-size:11.5px;cursor:pointer;background:#f8fafc}
.zone:hover{border-color:#cbd5e1;background:#f1f5f9}
.zone b{color:var(--teal)}
.zone .coords{color:var(--grey);font-size:10px}
.gapbadge{font-size:10.5px;font-weight:700;color:#166534;background:#dcfce7;border-radius:999px;padding:2px 7px}

.method{margin-top:18px;font-size:11.5px;color:#374151;border:1px solid #eef2f7;border-radius:10px;padding:10px 12px;background:#fbfcfd}
.method summary{cursor:pointer;font-weight:600;color:var(--navy)}
.method p{margin:7px 0 0;line-height:1.45}

.foot{font-size:10px;color:var(--grey);padding:6px 20px;border-top:1px solid var(--line);background:#fff}
.foot a{color:var(--teal)}

.leaflet-popup-content{font-size:12px;line-height:1.4}
.pop-name{font-weight:700;color:var(--navy);font-size:13px;margin-bottom:2px}
.pop-addr{color:#4b5563}
.pop-meta{margin-top:4px;color:var(--grey);font-size:11px}
.pop-link{color:var(--teal);font-size:11px}

@media (max-width: 900px){
  .layout{flex-direction:column}
  .map-wrap{min-height:56vh}
  .panel{width:auto;max-width:none;border-left:0;border-top:1px solid var(--line)}
  .map-overlay{max-width:220px}
}

.zone-marker span{
  width:28px;height:28px;border-radius:50%;display:flex;align-items:center;justify-content:center;
  background:#166534;color:#fff;font-size:13px;font-weight:700;border:2px solid #fff;
  box-shadow:0 2px 6px rgba(0,0,0,.35);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;
}

/* вкладки в панели */
.tabs{display:flex;gap:4px;margin:0 0 10px;background:#eef2f7;border-radius:10px;padding:4px}
.tabs button{flex:1;border:0;background:transparent;padding:8px 6px;border-radius:8px;font-size:12px;font-weight:600;color:#4b5563;cursor:pointer}
.tabs button.active{background:#fff;color:var(--navy);box-shadow:0 1px 4px rgba(0,0,0,.08)}
.pane.hidden{display:none}
.source-note{font-size:10px;color:var(--grey);margin:6px 0 2px;line-height:1.4}
.chips{display:flex;flex-wrap:wrap;gap:6px}
.chips span{background:#eef2f7;border-radius:999px;padding:4px 9px;font-size:11px;color:#374151}
.chips b{color:var(--teal);font-weight:600}
.quote{font-size:11px;line-height:1.45;color:#374151;border-left:3px solid var(--teal);padding:6px 9px;margin:6px 0;background:#f8fafc;border-radius:0 8px 8px 0}
.quote.neg{border-left-color:#b91c1c;background:#fef2f2}

/* ================= бот подбора ================= */
.bot-form{display:flex;flex-direction:column;gap:8px;margin-bottom:10px}
.bot-row{display:flex;gap:6px}
.bot-input-text{flex:1;min-width:0;border:1px solid #dfe3ea;border-radius:8px;padding:8px 9px;font-size:12px;font-family:inherit;background:#fff}
.bot-row input{flex:1;min-width:0;border:1px solid #dfe3ea;border-radius:8px;padding:8px 9px;font-size:12px;font-family:inherit}
.bot-flags{display:flex;flex-wrap:wrap;gap:6px 10px;font-size:11px;color:#4b5563}
.bot-flags label{display:flex;align-items:center;gap:4px}
.bot-primary{border:0;background:var(--navy);color:#fff;border-radius:8px;padding:8px 12px;font-size:12px;font-weight:600;cursor:pointer}
.bot-primary:hover{background:#0f2438}
.bot-secondary{border:1px solid #dfe3ea;background:#fff;color:#374151;border-radius:8px;padding:8px 12px;font-size:12px;font-weight:600;cursor:pointer}
.bot-chat{max-height:260px;overflow-y:auto;display:flex;flex-direction:column;gap:6px;padding:8px;background:#f8fafc;border-radius:10px;margin-bottom:8px}
.bot-msg{max-width:92%;padding:7px 10px;border-radius:10px;font-size:11px;line-height:1.45}
.bot-msg.bot{background:#fff;border:1px solid #e5e7eb;align-self:flex-start}
.bot-msg.user{background:var(--navy);color:#fff;align-self:flex-end}
.bot-chips{display:flex;flex-wrap:wrap;gap:6px;padding:2px 4px}
.bot-chips button{border:1px solid #dfe3ea;background:#fff;border-radius:999px;padding:5px 10px;font-size:11px;cursor:pointer;color:#374151}
.bot-chips button:hover{border-color:var(--teal);color:var(--teal)}
.bot-send-row{margin-bottom:10px}
.bot-results{display:flex;flex-direction:column;gap:8px}
.bot-card{border:1px solid #e5e7eb;border-radius:12px;padding:10px;background:#fff;margin-bottom:8px}
.bot-card-head{display:flex;justify-content:space-between;align-items:center;gap:8px;font-size:12px;color:#111827}
.bot-card-sub{font-size:10px;color:var(--grey);margin-top:3px}
.bot-score{font-size:16px;font-weight:700;border-radius:8px;padding:2px 8px}
.bot-score.good{background:#dcfce7;color:#166534}
.bot-score.mid{background:#fef3c7;color:#92400e}
.bot-score.bad{background:#fee2e2;color:#991b1b}
.bot-prob{font-size:11px;color:#374151;margin:6px 0}
.bot-kv{display:flex;justify-content:space-between;gap:10px;font-size:11px;padding:3px 0;border-bottom:1px dashed #f1f5f9}
.bot-kv span{color:var(--grey)}
.bot-factors{margin:8px 0 4px}
.bot-factor{display:grid;grid-template-columns:88px 1fr 46px;gap:6px;align-items:center;font-size:10px;color:#4b5563;margin:3px 0}
.bot-factor .bar-track{background:#eef2f7;border-radius:999px;height:7px;overflow:hidden;display:block}
.bot-factor .bar-fill{display:block;height:100%;background:var(--teal)}
.bot-factor .bar-num{text-align:right;color:#111827}
.bot-warn{background:#fffbeb;border:1px solid #fde68a;color:#92400e;border-radius:8px;padding:6px 8px;font-size:10px;margin:6px 0}
.bot-details{margin:6px 0;font-size:10px;color:#374151}
.bot-details summary{cursor:pointer;color:var(--teal)}
.bot-comp-row{display:flex;justify-content:space-between;gap:8px;padding:3px 0;border-bottom:1px dashed #f1f5f9}
.bot-card-actions{display:flex;gap:6px;margin-top:8px}
.bot-btn{border:1px solid #dfe3ea;background:#fff;border-radius:8px;padding:5px 9px;font-size:10px;cursor:pointer;color:#374151}
.bot-btn:hover{border-color:var(--teal);color:var(--teal)}
.bot-btn.small{padding:1px 7px;font-size:12px}
.bot-comment{margin-top:8px;font-size:10px;line-height:1.45;color:#374151;background:#f0fdfa;border-left:3px solid var(--teal);border-radius:0 8px 8px 0;padding:6px 8px}
.bot-comment:empty{display:none}
.bot-table{width:100%;border-collapse:collapse;font-size:10px}
.bot-table th,.bot-table td{text-align:left;padding:5px 4px;border-bottom:1px solid #eef2f7;vertical-align:top}
.bot-table th{color:var(--grey);font-weight:600}
.bot-marker span{width:26px;height:26px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:#16324f;color:#fff;font-size:11px;font-weight:700;border:2px solid #fff;box-shadow:0 2px 6px rgba(0,0,0,.35)}

/* зоны роста: действия и сравнение */
.zone-item{border-bottom:1px solid #eef2f7;padding:5px 0}
.zone-item .zone{border-bottom:0;padding:0}
.zone-actions{display:flex;gap:6px;justify-content:flex-end;margin-top:2px}
.zone-tools{display:flex;gap:6px;margin-top:6px}
