/* «Сравни себя с рынком» — прототип. Автономные стили, без внешних шрифтов. */
:root {
  --bg: #f3f5f9;
  --panel: #ffffff;
  --ink: #1a2233;
  --muted: #6b7689;
  --line: #e4e8f0;
  --line-2: #eef1f6;
  --brand: #1e4bd2;       /* фирменный синий */
  --brand-d: #0a2896;
  --brand-l: #eaf0ff;
  --accent: #00b3c4;
  --good: #1fb36b;
  --bad: #e2495a;
  --warn: #e69a16;
  --shadow: 0 1px 2px rgba(16,30,60,.06), 0 6px 24px rgba(16,30,60,.06);
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
a { color: var(--brand); text-decoration: none; }
.hidden { display: none !important; }

/* ---------- Каркас (rail-меню, раскрытие по наведению) ---------- */
.app { min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, #0a1f5c, #0a2896 60%, #103bb0);
  color: #cdd8f5; padding: 16px 12px; position: fixed; left: 0; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 4px; overflow: hidden; z-index: 40;
  width: 66px; transition: width .16s ease, box-shadow .16s ease;
}
.sidebar:hover { width: 256px; box-shadow: 6px 0 28px rgba(10,30,90,.25); overflow-y: auto; }
.sidebar .brandtext, .sidebar .navlbl, .sidebar .nav-group, .sidebar .badge { opacity: 0; transition: opacity .12s; white-space: nowrap; }
.sidebar:hover .brandtext, .sidebar:hover .navlbl, .sidebar:hover .nav-group, .sidebar:hover .badge { opacity: 1; }
.sidebar .nav-item { overflow: hidden; }
.main { margin-left: 66px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; }
.brand .logo {
  width: 38px; height: 38px; border-radius: 10px; background: #fff; color: var(--brand-d);
  display: grid; place-items: center; font-weight: 800; font-size: 17px; letter-spacing: -1px;
}
.brand .ttl { font-weight: 700; color: #fff; font-size: 14px; line-height: 1.15; }
.brand .sub { font-size: 11px; color: #9db0e6; }
.nav-group { margin-top: 10px; font-size: 11px; text-transform: uppercase;
  letter-spacing: .06em; color: #7d92cf; padding: 8px 10px 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px;
  color: #cdd8f5; font-size: 13.5px; border: 0; background: transparent; width: 100%;
  text-align: left; transition: background .12s;
}
.nav-item:hover { background: rgba(255,255,255,.08); }
.nav-item.active { background: #fff; color: var(--brand-d); font-weight: 600; }
.nav-item .ic { width: 18px; text-align: center; opacity: .9; }
.nav-item .badge {
  margin-left: auto; font-size: 10px; padding: 1px 6px; border-radius: 20px;
  background: rgba(255,255,255,.16); color: #dfe7ff;
}
.nav-item.active .badge { background: var(--brand-l); color: var(--brand-d); }
.badge.r2 { background: #fde7c2; color: #8a5a00; }
.badge.r3 { background: #e7d9ff; color: #5a2ea6; }
.sidebar-foot { margin-top: auto; font-size: 11px; color: #8da3df; padding: 12px 10px 4px; border-top: 1px solid rgba(255,255,255,.1); }

.main { min-width: 0; display: flex; flex-direction: column; }
.main.mapmode .topbar { display: none; }
.main.mapmode .content { padding: 0; height: 100vh; overflow: hidden; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 12px 22px;
  background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 700; }
.topbar .crumb { color: var(--muted); font-size: 12.5px; }
.topbar .spacer { flex: 1; }
.userchip { display: flex; align-items: center; gap: 9px; padding: 5px 10px 5px 6px;
  border: 1px solid var(--line); border-radius: 30px; background: #fff; }
.userchip .av { width: 28px; height: 28px; border-radius: 50%; background: var(--brand);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.userchip .nm { font-size: 12.5px; font-weight: 600; }
.userchip .rl { font-size: 11px; color: var(--muted); }

.content { padding: 20px 22px 40px; }

/* ---------- Общие компоненты ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); }
.card .card-h { padding: 13px 16px; border-bottom: 1px solid var(--line-2);
  font-weight: 700; font-size: 13.5px; display: flex; align-items: center; gap: 8px; }
.card .card-b { padding: 16px; }
.grid { display: grid; gap: 16px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px;
  padding: 3px 9px; border-radius: 30px; background: var(--brand-l); color: var(--brand-d); font-weight: 600; }
.pill.r2 { background: #fde7c2; color: #8a5a00; }
.pill.r3 { background: #e7d9ff; color: #5a2ea6; }
.pill.ok { background: #d8f5e6; color: #0e7a45; }
.tag { display: inline-block; width: 9px; height: 9px; border-radius: 3px; }

.btn { border: 1px solid var(--brand); background: var(--brand); color: #fff; padding: 9px 16px;
  border-radius: 10px; font-weight: 600; font-size: 13.5px; }
.btn:hover { background: var(--brand-d); border-color: var(--brand-d); }
.btn.ghost { background: #fff; color: var(--brand); }
.btn.ghost:hover { background: var(--brand-l); }
.btn.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.kpi { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi .k { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .k .lab { font-size: 12px; color: var(--muted); }
.kpi .k .val { font-size: 24px; font-weight: 800; margin-top: 4px; letter-spacing: -.5px; }
.kpi .k .delta { font-size: 12px; margin-top: 4px; font-weight: 600; }
.delta.up { color: var(--good); } .delta.down { color: var(--bad); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); }
table.tbl tr:last-child td { border-bottom: 0; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Гео-экран ---------- */
.geo { display: grid; grid-template-columns: 1fr 360px; gap: 16px; align-items: start; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.seg { display: inline-flex; background: #eef1f7; border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 8px;
  font-size: 12.5px; color: var(--muted); font-weight: 600; }
.seg button.on { background: #fff; color: var(--brand-d); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.field { display: flex; flex-direction: column; gap: 3px; }
.field label { font-size: 11px; color: var(--muted); font-weight: 600; }
select, input[type=text], input[type=number], input[type=password] {
  font-family: inherit; font-size: 13px; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 9px; background: #fff; color: var(--ink); }
select:focus, input:focus { outline: none; border-color: var(--brand); }

.mapwrap { position: relative; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.maphead { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line-2); }
.maphead .ttl { font-weight: 700; font-size: 13.5px; }
.mapstage { position: relative; height: 620px; background: #e9eef4; cursor: grab; }
.mapstage.dragging { cursor: grabbing; }
.mapstage svg { display: block; width: 100%; height: 100%; }
.mapctrl { position: absolute; left: 12px; top: 12px; display: flex; flex-direction: column; gap: 6px; z-index: 5; }
.mapctrl button { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line);
  background: #fff; font-size: 18px; font-weight: 700; color: var(--ink); box-shadow: var(--shadow); }
.maplegend { position: absolute; right: 12px; bottom: 12px; background: rgba(255,255,255,.94);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; font-size: 11.5px;
  max-width: 230px; box-shadow: var(--shadow); }
.maplegend .row { display: flex; align-items: center; gap: 7px; margin: 3px 0; }
.maphint { position: absolute; left: 12px; bottom: 12px; background: rgba(255,255,255,.94);
  border: 1px solid var(--line); border-radius: 10px; padding: 7px 11px; font-size: 11.5px; color: var(--muted); box-shadow: var(--shadow); }

.dot { cursor: pointer; }
.dot:hover { stroke: #1a2233; stroke-width: 1.5; }
.dot.mine { stroke: #fff; stroke-width: 2.5; }
.dot.dim { opacity: .18; }
.zone-fill { fill: rgba(30,75,210,.10); stroke: var(--brand); stroke-width: 2; }
.zone-fill.poly { fill: rgba(0,179,196,.10); stroke: var(--accent); }

/* Правая панель карточек */
.sidecard .seg { width: 100%; }
.price-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.price-cell { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.price-cell .nm { font-size: 11.5px; color: var(--muted); }
.price-cell .vl { font-size: 17px; font-weight: 800; margin-top: 2px; }
.section-lab { font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 700; margin: 16px 0 8px; }
.compare-box { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fafbfe; }
.compare-box h4 { margin: 0 0 4px; font-size: 14px; }
.range-line { font-size: 12.5px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.range-line:last-child { border-bottom: 0; }
.range-line b { font-variant-numeric: tabular-nums; }
.locked { text-align: center; padding: 26px 14px; color: var(--muted); }
.locked .ic { font-size: 30px; }
.notice { background: #fff7e6; border: 1px solid #f3dca0; color: #8a5a00;
  border-radius: 10px; padding: 10px 12px; font-size: 12.5px; }

/* ---------- Чарты ---------- */
.chart { width: 100%; }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .gridln { stroke: var(--line-2); stroke-width: 1; }
.chart .lbl { fill: var(--muted); font-size: 11px; }
.chart .area { fill: rgba(30,75,210,.10); }
.chart .line { fill: none; stroke: var(--brand); stroke-width: 2.5; }
.chart .line.alt { stroke: var(--accent); }
.chart .bar { fill: var(--brand); }
.chart .bar.alt { fill: var(--accent); }
.chart .pt { fill: var(--brand); }
.legend-inline { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend-inline .li { display: flex; align-items: center; gap: 6px; }
.legend-inline .sw { width: 14px; height: 4px; border-radius: 2px; }

/* ---------- Логин ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: linear-gradient(160deg, #0a1f5c, #103bb0 70%, #1e4bd2);
  color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.login-art h2 { font-size: 30px; margin: 0; line-height: 1.15; }
.login-art p { color: #c4d2f5; max-width: 440px; }
.login-art .feat { display: flex; gap: 10px; align-items: flex-start; margin-top: 8px; }
.login-art .feat .ic { width: 26px; }
.login-form { display: grid; place-items: center; padding: 40px; }
.login-card { width: 360px; }
.login-card .fld { margin-bottom: 13px; }
.login-card .fld label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.login-card input { width: 100%; }
.login-hint { font-size: 12px; color: var(--muted); margin-top: 12px; text-align: center; }

/* ---------- Прочее ---------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.three-col { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.list-clean { list-style: none; padding: 0; margin: 0; }
.list-clean li { padding: 9px 0; border-bottom: 1px solid var(--line-2); display: flex; gap: 10px; align-items: flex-start; }
.list-clean li:last-child { border-bottom: 0; }
.dotmark { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); margin-top: 6px; flex: none; }
.stepper { display: flex; flex-direction: column; gap: 0; }
.step { display: grid; grid-template-columns: 32px 1fr; gap: 14px; padding-bottom: 18px; position: relative; }
.step:not(:last-child)::before { content: ''; position: absolute; left: 15px; top: 30px; bottom: 0; width: 2px; background: var(--line); }
.step .mark { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-l); color: var(--brand-d);
  display: grid; place-items: center; font-weight: 800; z-index: 1; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.step.done .mark { background: var(--good); color: #fff; }
.step .h { font-weight: 700; }
.chat { display: flex; flex-direction: column; gap: 12px; height: 440px; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 4px; }
.msg { max-width: 78%; padding: 10px 13px; border-radius: 14px; font-size: 13.5px; }
.msg.bot { background: #f1f4fb; border: 1px solid var(--line); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.me { background: var(--brand); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.chat-in { display: flex; gap: 8px; }
.chat-in input { flex: 1; }
.suggest { display: flex; gap: 8px; flex-wrap: wrap; }
.suggest button { font-size: 12px; padding: 6px 11px; border-radius: 20px; border: 1px solid var(--line); background: #fff; color: var(--brand-d); }
.suggest button:hover { background: var(--brand-l); }
.banner { background: linear-gradient(120deg, var(--brand-l), #fff); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; display: flex; gap: 16px; align-items: center; }
.banner .big { font-size: 30px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: #1a2233; color: #fff; padding: 11px 18px; border-radius: 10px; font-size: 13px;
  box-shadow: var(--shadow); z-index: 100; opacity: 0; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
@media (max-width: 1100px) {
  .geo { grid-template-columns: 1fr; } .kpi { grid-template-columns: repeat(2,1fr); }
  .login-wrap { grid-template-columns: 1fr; } .login-art { display: none; }
}

/* ====================================================================
   ПОЛНОЭКРАННАЯ КАРТА (главная страница)
   ==================================================================== */
.mappage { position: relative; height: 100vh; width: 100%; overflow: hidden; background: #e9eef4; }
.mappage .mapstage { position: absolute; inset: 0; height: 100%; width: 100%; background: #aadaff; z-index: 1; }
.leaflet-container { font: inherit; }

/* плавающая верхняя панель */
.maptop { position: absolute; left: 0; right: 0; top: 0; height: 56px; z-index: 8;
  display: flex; align-items: center; gap: 14px; padding: 0 18px; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,0)); }
.maptop .mt-title { font-weight: 800; font-size: 16px; pointer-events: auto; }
.maptop .userchip { margin-left: auto; pointer-events: auto; background: #fff; }

/* виджеты на карте */
.mapwidget { position: absolute; z-index: 7; background: rgba(255,255,255,.97);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.mapwidget .w-h { padding: 11px 14px; border-bottom: 1px solid var(--line-2); font-weight: 700;
  font-size: 13px; display: flex; align-items: center; gap: 8px; }
.mapwidget .w-b { padding: 14px; overflow-y: auto; }
.wfilters { left: 16px; top: 70px; width: 250px; padding: 12px 14px 14px; max-height: calc(100vh - 96px); overflow-y: auto; }
.wfilters .w-h { padding: 0 0 8px; border: 0; }
.wfilters .field { margin-bottom: 10px; }
.wfilters select { width: 100%; }
.wpanel { right: 16px; top: 70px; width: 340px; max-height: calc(100vh - 96px); display: flex; flex-direction: column; }
.wpanel .w-b { max-height: calc(100vh - 150px); }
.panel-actions { display: flex; gap: 8px; margin-top: 14px; }
.panel-actions .btn { flex: 1; }

.seg-sm button { padding: 6px 9px; font-size: 11.5px; }
.btn.xs { padding: 4px 9px; font-size: 11.5px; border-radius: 7px; margin-left: auto; }
.r3tag { font-size: 9px; background: #e7d9ff; color: #5a2ea6; padding: 1px 5px; border-radius: 10px; font-weight: 700; }

/* масштабная линейка */
.mapscale { position: absolute; left: 16px; bottom: 16px; z-index: 6; background: rgba(255,255,255,.92);
  border: 1px solid var(--line); border-radius: 8px; padding: 5px 9px; font-size: 11px; color: var(--ink);
  display: flex; align-items: center; gap: 8px; box-shadow: var(--shadow); }
.mapscale .bar { height: 6px; border: 2px solid #1a2233; border-top: 0; width: 100px; }
.mappage .maplegend { position: absolute; left: 16px; right: auto; bottom: 40px; z-index: 6; }
.mappage .mapctrl { position: absolute; left: 50%; right: auto; top: auto; bottom: 16px; transform: translateX(-50%); flex-direction: row; z-index: 6; }
.metric-row { display: flex; justify-content: space-between; align-items: baseline; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.metric-row b { font-size: 14px; }
.pill-btn { border: 0; cursor: pointer; font: inherit; font-weight: 600; }
.pill-btn:hover { filter: brightness(0.96); text-decoration: underline; }

/* маркер «моя точка» */
.my-point-marker { position: relative; cursor: pointer; }
.my-point-marker .mp-core { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 30px; height: 30px; border-radius: 50%; background: #1e4bd2; border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(10,30,90,.55); color: #fff; font-size: 15px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; z-index: 2; }
.my-point-marker .mp-ring { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 30px; height: 30px; border-radius: 50%; background: rgba(30,75,210,.45); z-index: 1;
  animation: mp-pulse 1.8s ease-out infinite; }
@keyframes mp-pulse { 0% { width: 30px; height: 30px; opacity: .7; } 100% { width: 66px; height: 66px; opacity: 0; } }

/* пометки «Релиз 2» */
.r2tag { display: inline-block; font-size: 9.5px; font-weight: 700; vertical-align: middle;
  background: #fde7c2; color: #8a5a00; padding: 1px 6px; border-radius: 10px; margin-left: 6px; }
.r2note { background: #fff7e6; border: 1px solid #f3dca0; color: #8a5a00; border-radius: 10px;
  padding: 10px 12px; font-size: 12.5px; }
.r2box { border: 1px dashed #e3c98f; background: #fffaf0; border-radius: 12px; padding: 12px; margin-top: 10px; }
.r2box-h { font-size: 12px; font-weight: 700; color: #8a5a00; margin-bottom: 6px; }
.r2dim .k { position: relative; }
.r2dim .k .val { opacity: .85; }
.sec-h { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em;
  color: var(--ink); margin: 6px 0 0; display: flex; align-items: center; gap: 8px; }
.spacer-tb { flex: 1; }
