@font-face{font-family:Manrope;src:url('fonts/manrope-latin.woff2') format('woff2');font-weight:200 800;font-display:swap;unicode-range:U+0000-00FF,U+2000-206F,U+2190-22FF}
@font-face{font-family:Manrope;src:url('fonts/manrope-cyrillic.woff2') format('woff2');font-weight:200 800;font-display:swap;unicode-range:U+0400-052F}

:root{
  --bg:#f3f5f7; --bg2:#f7f9fa; --panel:#ffffff; --panel2:#ffffff; --line:#e3e8ec; --line2:#cfd7dd;
  --text:#0d1418; --muted:#55616a; --muted2:#86919a; --red:#e3262d; --red2:#ff3339; --ok:#16884f; --warn:#b86e00;
  --shadow:0 1px 2px #0d14180a,0 8px 24px #0d14180d;
  --r:14px; --r-sm:10px;
  color-scheme:light;
}
*{box-sizing:border-box}
html,body{margin:0;height:100%}
body{font-family:Manrope,Arial,sans-serif;background:var(--bg);color:var(--text);font-size:15px;line-height:1.45;-webkit-font-smoothing:antialiased}
button,input,select,textarea{font:inherit;color:inherit}
button{cursor:pointer;border:0;background:none;padding:0}
a{color:inherit}
:focus-visible{outline:2px solid var(--text);outline-offset:3px}
[hidden]{display:none!important}
.muted{color:var(--muted)} .small{font-size:13px}
mark{background:none;color:var(--red2);font-weight:700}
.red-dash{display:inline-block;width:28px;height:3px;background:var(--red);border-radius:2px}

/* ---------- Каркас ---------- */
.app{display:grid;grid-template-columns:260px minmax(0,1fr) 320px;min-height:100vh;
  background:radial-gradient(ellipse 70% 60% at 65% 0%,#e6ecf0 0%,transparent 70%),var(--bg)}

.sidebar{position:sticky;top:0;height:100vh;display:flex;flex-direction:column;gap:14px;padding:26px 20px;border-right:1px solid var(--line);background:#ffffffe6;backdrop-filter:blur(8px)}
.brand img{width:170px;height:auto;display:block;filter:brightness(0) saturate(100%)}
.tool-title{font-weight:700;font-size:19px;line-height:1.2;letter-spacing:-.01em;margin:6px 0 8px}
.tool-title .red-dash{display:block;margin-bottom:12px}
.side-link{display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:var(--r-sm);color:var(--muted);font-weight:600;text-decoration:none;text-align:left;transition:.15s}
.side-link:hover{background:var(--bg);color:var(--text)}
.side-link svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}
.side-link.small{font-size:13px}
.side-bottom{margin-top:auto;display:flex;flex-direction:column;gap:10px}
.support{padding:14px;border-radius:var(--r);background:var(--bg);border:1px solid var(--line);font-size:13px;color:var(--muted)}
.support p{margin:0 0 4px}
.support-link,[data-mail]{color:var(--text);text-decoration:underline;text-decoration-color:var(--red);text-underline-offset:3px;cursor:pointer}

.main{padding:28px;min-width:0}
.grid{display:grid;grid-template-columns:minmax(300px,1fr) minmax(0,1.6fr);gap:20px;align-items:start}
.col-search{display:flex;flex-direction:column;gap:20px;min-width:0}

.panel{background:var(--panel);box-shadow:var(--shadow);border:1px solid var(--line);border-radius:var(--r);padding:22px}
.panel-title{margin:0 0 4px;font-size:21px;font-weight:700;letter-spacing:-.01em}
.panel-sub{margin:0 0 16px;color:var(--muted);font-size:14px}

/* ---------- Поиск ---------- */
.search-box{position:relative}
.search-box input{width:100%;height:50px;padding:0 76px 0 44px;border-radius:var(--r-sm);background:var(--bg2);border:1px solid var(--line2);outline:0;transition:.15s}
.search-box input:focus{border-color:var(--muted)}
.search-box input::-webkit-search-cancel-button{display:none}
.search-icon{position:absolute;left:14px;top:15px;width:20px;height:20px;fill:none;stroke:var(--muted2);stroke-width:1.8;stroke-linecap:round}
.hint-btn,.clear-btn{position:absolute;top:12px;width:26px;height:26px;border-radius:50%;color:var(--muted);font-weight:700;font-size:14px;border:1px solid var(--line2)}
.hint-btn{right:12px} .clear-btn{right:44px;font-size:18px;line-height:22px;border:0}
.hint-btn:hover,.clear-btn:hover{color:var(--text)}
.hint-pop{position:absolute;z-index:6;right:0;top:56px;width:min(340px,100%);padding:14px 16px;border-radius:var(--r-sm);background:var(--panel2);border:1px solid var(--line2);font-size:13px;color:var(--muted);box-shadow:0 20px 40px #0d141826}
.hint-pop b{color:var(--text)} .hint-pop p{margin:8px 0 0}
.dropdown{position:absolute;z-index:5;left:0;right:0;top:56px;max-height:min(440px,60vh);overflow:auto;border-radius:var(--r-sm);background:var(--panel2);border:1px solid var(--line2);box-shadow:0 24px 48px #0d141829;padding:6px}
.dd-group{padding:10px 10px 4px;font-size:11px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--muted2)}
.dd-item{display:flex;flex-direction:column;width:100%;text-align:left;padding:8px 10px;border-radius:8px}
.dd-item:hover,.dd-item.is-active{background:#eef2f5}
.dd-title{font-weight:600} .dd-sub{font-size:12.5px;color:var(--muted)}
.dd-empty{padding:16px;color:var(--muted);font-size:14px}

/* ---------- Референс ---------- */
.ref-panel{display:flex;flex-direction:column;gap:14px}
.field{display:flex;flex-direction:column;gap:6px;font-size:13px;color:var(--muted)}
.field select,.field input,.field textarea{width:100%;padding:11px 12px;border-radius:var(--r-sm);background:var(--bg2);border:1px solid var(--line2);color:var(--text);font-size:14px;outline:0}
.field select:focus,.field input:focus,.field textarea:focus{border-color:var(--muted)}
.field select:disabled{opacity:.5}
.ref-info{margin:0;padding:14px;border-radius:var(--r-sm);background:var(--bg2);border:1px solid var(--line);display:flex;flex-direction:column;gap:6px;font-size:14px}
.ref-info div{display:grid;grid-template-columns:118px 1fr;gap:8px}
.ref-info dt{color:var(--muted)} .ref-info dd{margin:0;font-weight:600;word-break:break-word}
.ref-actions{display:flex;flex-wrap:wrap;align-items:flex-end;gap:10px}
.qty-field{flex:0 0 auto}

.stepper{display:inline-flex;align-items:center;border:1px solid var(--line2);border-radius:var(--r-sm);background:var(--bg2);height:42px}
.stepper button{width:34px;height:100%;font-size:18px;color:var(--muted)} .stepper button:hover{color:var(--text)}
.stepper input{width:56px;height:100%;text-align:center;background:none;border:0;padding:0;outline:0;-moz-appearance:textfield;font-weight:600}
.stepper input::-webkit-inner-spin-button{display:none}

/* ---------- Кнопки ---------- */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;height:42px;padding:0 18px;border-radius:999px;font-weight:700;font-size:14px;text-decoration:none;transition:.15s;white-space:nowrap}
.btn:disabled{opacity:.35;cursor:default}
.btn-primary{background:var(--red);color:#fff} .btn-primary:not(:disabled):hover{background:var(--red2)}
.btn-ghost{border:1px solid var(--line2);color:var(--text)} .btn-ghost:hover{border-color:var(--muted)}
.btn-link{padding:0 6px;color:var(--muted)} .btn-link:hover{color:var(--text)}
.icon-btn{width:32px;height:32px;border-radius:8px;display:grid;place-items:center;color:var(--muted2)}
.icon-btn:hover{color:var(--red);background:#ff333914}
.icon-btn svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}

/* ---------- Рекомендованная замена ---------- */
.analog-panel{min-height:420px;display:flex;flex-direction:column;gap:14px}
.analog-panel.is-empty{border-style:dashed;border-color:var(--line2);background:#ffffff80;box-shadow:none}
.placeholder{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:18px;color:var(--muted2);text-align:center;padding:30px}
.ph-theta{width:64px;opacity:.12;filter:invert(1)}
.ref-line{color:var(--muted);font-size:14px} .ref-line b{color:var(--text)}
.note{margin:0;color:var(--muted)} .note.small{font-size:13px}
.not-found{padding:18px;border-radius:var(--r-sm);border:1px solid #ff333955;background:#ff33390d}
.not-found p{margin:8px 0 0;color:var(--muted)}
.tabs{display:flex;flex-wrap:wrap;gap:10px}
.tab{flex:1 1 200px;text-align:left;padding:12px 14px;border-radius:var(--r-sm);border:1px solid var(--line2);font-weight:700}
.tab small{display:block;font-weight:500;color:var(--muted);margin-top:2px}
.tab.is-active{border-color:var(--red);background:#ff33390f}

.product{display:grid;grid-template-columns:200px minmax(0,1fr);align-items:start;gap:22px;padding:18px;border-radius:var(--r);background:var(--bg2);border:1px solid var(--line)}
/* Фото товаров вертикальные (2:3 и 5:6) на белом фоне: рамка 3:4, картинка целиком вписывается без обрезки */
.product-img{position:relative;border-radius:var(--r-sm);background:#fff;border:1px solid var(--line);aspect-ratio:3/4;overflow:hidden}
.product-img img{position:absolute;inset:4%;width:92%;height:92%;object-fit:contain;object-position:center}
.product-series{font-size:11px;font-weight:700;letter-spacing:.14em;color:var(--red)}
.product-article{font-size:26px;font-weight:800;letter-spacing:-.01em;margin:2px 0}
.product-article .x{color:var(--muted);font-weight:600;font-size:18px}
.product-name{color:var(--muted);margin-bottom:12px}
.specs{display:grid;grid-template-columns:repeat(auto-fill,minmax(170px,1fr));gap:8px 16px;margin-bottom:12px}
.spec{display:flex;flex-direction:column;font-size:13px}
.spec span{color:var(--muted2)} .spec b{font-weight:600}
.cmp{width:100%;border-collapse:collapse;font-size:13px}
.cmp th,.cmp td{text-align:left;padding:7px 8px;border-top:1px solid var(--line)}
.cmp th{color:var(--muted);font-weight:600}
.cmp td:first-child{color:var(--muted)}
.cmp td.ok{color:var(--ok);font-weight:700} .cmp td.warn{color:var(--warn);font-weight:700}
.analog-actions{display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin-top:auto;padding-top:4px}
.done{color:var(--ok);font-weight:700;margin-right:6px}

/* ---------- Подобранное ---------- */
.picked{position:sticky;top:0;height:100vh;display:flex;flex-direction:column;border-left:1px solid var(--line);background:#ffffffe6;backdrop-filter:blur(8px)}
.picked-head{display:flex;align-items:center;gap:10px;padding:26px 20px 14px;font-weight:700;font-size:18px;text-align:left;cursor:default}
.picked-count{min-width:24px;height:24px;padding:0 7px;border-radius:12px;background:var(--red);color:#fff;font-size:13px;display:grid;place-items:center}
.picked-head .chev{display:none;margin-left:auto;width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2}
.picked-body{flex:1;min-height:0;display:flex;flex-direction:column}
.picked-list{flex:1;overflow:auto;padding:0 14px;display:flex;flex-direction:column;gap:10px}
.picked-empty{padding:0 6px}
.pick{padding:12px;border-radius:var(--r-sm);background:var(--bg2);border:1px solid var(--line);display:flex;flex-direction:column;gap:10px}
.pick-top{display:flex;justify-content:space-between;gap:8px}
.pick-analog{font-weight:800}
.pick-ref{font-size:12.5px;color:var(--muted)}
.pick .stepper{height:34px;align-self:flex-start} .pick .stepper input{width:48px}
.picked-actions{padding:14px;display:flex;flex-direction:column;gap:8px;border-top:1px solid var(--line)}
.picked-actions .btn{width:100%}

/* ---------- Модалка, тосты ---------- */
.modal{width:min(720px,calc(100% - 32px));max-height:calc(100vh - 48px);padding:30px;border-radius:18px;border:1px solid var(--line2);background:var(--panel);color:var(--text)}
.modal::backdrop{background:#0d141873;backdrop-filter:blur(3px)}
.modal h2{margin:0 0 12px;font-size:22px} .modal h3{margin:20px 0 6px;font-size:16px}
.modal p,.modal li{color:var(--muted)} .modal ul{padding-left:20px}
.modal .field{margin-top:12px}
.modal-close{position:absolute;top:14px;right:16px;font-size:26px;color:var(--muted)}
.nps-row{display:grid;grid-template-columns:repeat(11,1fr);gap:4px;margin-top:10px}
.nps{height:38px;border-radius:8px;border:1px solid var(--line2);font-weight:700}
.nps:hover{border-color:var(--muted)} .nps.is-active{background:var(--red);border-color:var(--red);color:#fff}
.nps-legend{display:flex;justify-content:space-between;font-size:12px;color:var(--muted2);margin-top:6px}
.toasts{position:fixed;z-index:50;bottom:20px;left:50%;transform:translateX(-50%);display:flex;flex-direction:column;gap:8px;align-items:center}
.toast{padding:12px 18px;border-radius:12px;background:var(--text);color:#fff;font-weight:600;box-shadow:0 10px 30px #0d141833;transition:.4s}
.toast-error{background:var(--red);color:#fff}
.toast.out{opacity:0;transform:translateY(10px)}
.noscript{padding:40px;text-align:center}

/* ---------- Встраивание (?embed=1) ---------- */
.embed .brand{display:none}
.embed .app{background:var(--bg)}

/* ---------- Адаптив ---------- */
@media (max-width:1560px){.grid{grid-template-columns:1fr}.col-search{display:grid;grid-template-columns:1fr 1fr;align-items:start}}
@media (max-width:1280px){
  .app{grid-template-columns:230px minmax(0,1fr) 290px}
  .grid{grid-template-columns:1fr}
}
@media (max-width:1100px){
  .app{grid-template-columns:1fr;display:flex;flex-direction:column}
  .sidebar{position:static;height:auto;flex-direction:row;flex-wrap:wrap;align-items:center;gap:10px 14px;padding:14px 16px;border-right:0;border-bottom:1px solid var(--line)}
  .brand img{width:120px}
  .tool-title{margin:0;font-size:15px}.tool-title br{display:none}.tool-title .red-dash{display:none}
  .side-link{padding:6px 8px;font-size:13px}
  .side-bottom{display:none}
  .main{padding:16px}
  .picked{position:fixed;left:0;right:0;bottom:0;top:auto;height:auto;max-height:70vh;z-index:20;border-left:0;border-top:1px solid var(--line2);background:#fffffff5;box-shadow:0 -8px 30px #0d14181a;border-radius:16px 16px 0 0}
  .picked-head{padding:14px 16px;cursor:pointer;width:100%}
  .picked-head .chev{display:block;transform:rotate(180deg);transition:.2s}
  .picked.is-collapsed .picked-body{display:none}
  .picked.is-collapsed .chev{transform:none}
  .picked-list{max-height:40vh}
  .picked-actions{flex-direction:row;flex-wrap:wrap} .picked-actions .btn{width:auto;flex:1}
  .main{padding-bottom:90px}
}
@media (max-width:640px){
  .panel{padding:16px}
  .product{grid-template-columns:1fr;padding:14px}
  .product-img{max-width:200px;justify-self:center;width:100%}
  .product-article{font-size:22px}
  .ref-info div{grid-template-columns:1fr;gap:0}
  .analog-actions .btn{flex:1}
  .modal{padding:22px 18px}
  .nps{height:32px;font-size:13px}
}
@media (max-width:820px){.col-search{grid-template-columns:1fr}}

/* ---------- Оценка соответствия ---------- */
.badge{display:inline-block;padding:3px 10px;border-radius:999px;font-size:12px;font-weight:700;margin-bottom:12px;white-space:nowrap}
.badge-full{background:#16884f1a;color:var(--ok)}
.badge-partial{background:#b86e001a;color:var(--warn)}
.badge-none{background:#e3262d14;color:var(--red)}
.result-table .badge{margin-bottom:4px}
.dot{display:inline-block;width:9px;height:9px;border-radius:50%;margin-left:8px;vertical-align:middle}
.dot-full{background:var(--ok)} .dot-partial{background:var(--warn)}
.tab-head{display:flex;align-items:center}
.product-img.is-empty{background:radial-gradient(circle at 50% 40%,#ffffff,#e9eef2 80%)}
.product-img .no-photo{inset:30%;width:40%;height:40%;filter:invert(1);opacity:.12}
.cmp-wrap{margin-top:-2px}
.cmp-title{font-weight:700;margin:6px 0 4px}
.cmp td,.cmp th{vertical-align:top}
.cmp td:nth-child(3){font-weight:600}
.st-ico{display:inline-grid;place-items:center;width:17px;height:17px;border-radius:50%;font-size:11px;font-weight:800;margin-right:6px;color:#fff;vertical-align:1px}
.st-ok .st-ico{background:var(--ok)} .st-warn .st-ico{background:var(--warn)}
.st-info .st-ico{background:var(--muted2)} .st-unknown .st-ico{background:var(--line2);color:var(--muted)}
.st-warn td:nth-child(3){color:var(--warn)}
.st-text{font-weight:500;font-size:12px;color:var(--muted);margin-top:2px}
.dd-sub b{font-weight:600;color:var(--text)}
