/* ИЗ-КП — подбор аналогов инструмента */
:root {
  --brand:        #005e96;   /* тёмно-синий логотипа */
  --brand-light:  #00a6e4;   /* светло-синий логотипа */
  --navy:         #252d76;   /* фирменный тёмно-синий */
  --green:        #1a7f45;
  --amber:        #a8710c;
  --grey:         #5a6472;
  --line:         #e3e8ef;
  --bg:           #f5f7fa;
  --card:         #ffffff;
  --text:         #1c2330;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", "Inter", system-ui, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

/* ---------- шапка ---------- */
header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 28px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(16, 32, 64, .05);
  position: relative;
}
header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 3px;
  background: linear-gradient(90deg, var(--brand-light) 0%, var(--brand) 45%, var(--navy) 100%);
}
.logo {
  height: 46px;
  width: auto;
  flex: none;
  padding-right: 20px;
  border-right: 1px solid var(--line);
}
.logo-text {
  display: block;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--brand);
}
.header-text { min-width: 0; }
header h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -.2px;
  color: var(--navy);
}
header .sub {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--grey);
}

main { padding: 24px 28px 48px; max-width: 1180px; margin: 0 auto; }

/* ---------- поиск ---------- */
.search-row { display: flex; gap: 10px; margin-bottom: 18px; }
.search-row input {
  flex: 1;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: border-color .15s, box-shadow .15s;
}
.search-row input:focus {
  outline: none;
  border-color: var(--brand-light);
  box-shadow: 0 0 0 3px rgba(0, 166, 228, .15);
}
.search-row input::placeholder { color: #9aa4b2; }
.search-row button {
  padding: 12px 26px;
  font-size: 15px;
  font-family: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--brand);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s;
}
.search-row button:hover { background: #004e7d; }

/* ---------- блоки ---------- */
.note {
  background: #eef7fd;
  border-left: 3px solid var(--brand-light);
  padding: 11px 14px;
  margin-bottom: 18px;
  border-radius: 0 6px 6px 0;
  color: #0f4c73;
}

.resolved-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 22px;
}
.resolved-box h2 {
  margin: 0 0 10px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--grey);
}
#resolved-content .row { margin-bottom: 4px; }
#resolved-content .label { color: var(--grey); display: inline-block; min-width: 190px; }

#results-box h2 {
  font-size: 15px;
  font-weight: 650;
  color: var(--navy);
  margin-bottom: 10px;
}

/* ---------- панель фильтров ---------- */
.toolbar {
  display: flex; align-items: center; gap: 16px;
  margin: 10px 0 12px; flex-wrap: wrap;
  font-size: 13px; color: var(--grey);
}
.toolbar label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.toolbar input[type=checkbox] { accent-color: var(--brand); width: 15px; height: 15px; }
.toolbar .spacer { flex: 1; }
button.secondary {
  padding: 7px 14px; font-size: 13px; font-family: inherit; font-weight: 500;
  background: var(--card); color: var(--brand);
  border: 1px solid #c8d6e2; border-radius: 7px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
button.secondary:hover { background: #f0f7fc; border-color: var(--brand-light); }
.copy-msg { color: var(--green); font-size: 12.5px; }

/* ---------- таблица ---------- */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  vertical-align: top;
}
th {
  background: #f8fafc;
  font-weight: 650;
  font-size: 11.5px;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--grey);
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafcfe; }

.status-pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
  white-space: nowrap;
}
.status-full    { background: #e6f5ec; color: var(--green);  border: 1px solid #bfe3cd; }
.status-partial { background: #fdf3e0; color: var(--amber);  border: 1px solid #f0dcb4; }
.status-check   { background: #eef1f5; color: var(--grey);   border: 1px solid #dbe1e9; }

tr.same td { background: #f4fbf6; }
tr.same:hover td { background: #eef9f2; }
td.mark { font-weight: 600; user-select: text; }

.error-box {
  background: #fdecec;
  border-left: 3px solid #b3261e;
  padding: 12px 14px;
  border-radius: 0 6px 6px 0;
  color: #7d1a15;
}

/* ---------- узкий экран ---------- */
@media (max-width: 620px) {
  header { padding: 12px 16px; gap: 14px; }
  .logo { height: 34px; padding-right: 14px; }
  header h1 { font-size: 16px; }
  header .sub { font-size: 11.5px; }
  main { padding: 16px 16px 32px; }
  .search-row { flex-direction: column; }
  #resolved-content .label { min-width: 0; display: block; font-size: 12px; }
}

/* остатки */
th.num, td.num { text-align: right; white-space: nowrap; }
td.num.has  { font-weight: 650; color: var(--green); font-variant-numeric: tabular-nums; }
td.num.none { color: #b4bcc8; }
.stock-date { margin: 0 0 8px; font-size: 12px; color: var(--grey); }

td.mat { max-width: 170px; }
td.mat b { color: var(--brand); font-weight: 650; }
.nodata { color: #b4bcc8; }

/* ---------- кнопка в шапке ---------- */
.header-btn {
  margin-left: auto;
  flex: none;
  padding: 9px 16px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  background: var(--card);
  border: 1px solid #c8d6e2;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.header-btn:hover { background: #f0f7fc; border-color: var(--brand-light); }

/* ---------- панель обновления данных ---------- */
.data-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 22px;
}
.data-grid { display: flex; gap: 18px; flex-wrap: wrap; }
.data-card {
  display: flex;
  flex-direction: column;
  flex: 1 1 320px;
  min-width: 290px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 14px 15px;
  background: #fbfdff;
}
.data-card h3 {
  margin: 0 0 6px;
  font-size: 13.5px;
  font-weight: 650;
  color: var(--navy);
}
.data-card .tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
  color: var(--brand);
  background: #e6f4fc;
  border: 1px solid #c3e4f6;
  vertical-align: 1px;
}
.data-card .hint { margin: 0 0 10px; font-size: 12px; color: var(--grey); }

.file-list { margin-bottom: 10px; }
.file-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  font-size: 12.5px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 5px;
}
.file-row .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
                   white-space: nowrap; font-weight: 550; }
.file-row .fmeta { color: var(--grey); white-space: nowrap; font-size: 11.5px; }
.file-row.empty { color: var(--amber); background: #fffaf0; border-color: #f0dcb4;
                  font-style: italic; }
.file-row .del {
  flex: none; width: 22px; height: 22px; padding: 0; line-height: 1;
  font-size: 13px; color: var(--grey); background: transparent;
  border: 1px solid var(--line); border-radius: 5px; cursor: pointer;
}
.file-row .del:hover { color: #b3261e; border-color: #e8b4b1; background: #fdecec; }

.file-pick { display: block; margin-bottom: 9px; }
.file-pick input[type=file] { display: none; }
.file-pick span {
  display: block;
  padding: 9px 12px;
  font-size: 12.5px;
  color: var(--brand);
  background: var(--card);
  border: 1px dashed #b9cfe0;
  border-radius: 7px;
  cursor: pointer;
  text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-pick span:hover { background: #f0f7fc; border-color: var(--brand-light); }

.data-card .check {
  display: flex; align-items: flex-start; gap: 7px;
  font-size: 12px; color: var(--grey); margin-bottom: 10px; cursor: pointer;
}
.data-card .check input { accent-color: var(--brand); margin-top: 2px; }

button.primary {
  width: 100%;
  margin-top: auto;
  padding: 10px 14px;
  font-family: inherit; font-size: 13px; font-weight: 600;
  color: #fff; background: var(--brand);
  border: none; border-radius: 7px; cursor: pointer;
  transition: background .15s;
}
button.primary:hover:not(:disabled) { background: #004e7d; }
button.primary:disabled { background: #c3cdd8; cursor: default; }

.data-state {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.data-state .row { margin-bottom: 3px; }
.data-state .label { color: var(--grey); display: inline-block; min-width: 160px; }

.update-log {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand-light);
  border-radius: 0 7px 7px 0;
  background: #f8fbfe;
  padding: 10px 13px;
}
.update-log.done   { border-left-color: var(--green);  background: #f4fbf6; }
.update-log.failed { border-left-color: #b3261e;       background: #fdf2f1; }
.update-head {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 12.5px; font-weight: 600; color: var(--navy);
  margin-bottom: 6px;
}
.update-head span:last-child { font-weight: 500; color: var(--grey); }
.update-log pre {
  margin: 0;
  font-family: "Consolas", "Menlo", monospace;
  font-size: 12px;
  color: #33404f;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow: auto;
}

/* ---------- контекстное меню ---------- */
.ctx-menu {
  position: fixed;
  z-index: 100;
  margin: 0;
  padding: 5px;
  list-style: none;
  min-width: 170px;
  background: var(--card);
  border: 1px solid #d3dce5;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(16, 32, 64, .16);
  font-size: 13px;
}
.ctx-menu li {
  padding: 7px 12px;
  border-radius: 5px;
  cursor: pointer;
  user-select: none;
}
.ctx-menu li:hover { background: #eef7fd; color: var(--brand); }
.ctx-menu li.off { color: #b4bcc8; cursor: default; }
.ctx-menu li.off:hover { background: transparent; color: #b4bcc8; }

/* характеристики в таблице */
td.spec { max-width: 180px; color: #41505f; font-size: 12.5px; }

/* выделение текста должно работать везде */
body, td, th { user-select: text; }

/* строки журнала обновления */
.update-log pre .warn { color: #8a5a00; background: #fff6e3; font-weight: 600;
                        display: inline-block; padding: 1px 4px; border-radius: 4px; }
.update-log pre .err  { color: #9c1f18; background: #fdecec; font-weight: 600;
                        display: inline-block; padding: 1px 4px; border-radius: 4px; }

/* откуда позиция: свой склад или склад поставщика */
td.src { white-space: nowrap; font-size: 12px; }
td.src.own { color: var(--green); font-weight: 600; }
td.src.msk { color: var(--grey); }

/* обоснование — самая длинная колонка, ей нужно больше места */
#results td:last-child { min-width: 260px; font-size: 12.5px; color: #41505f; }
#results td.mark { max-width: 190px; }

/* значение из инвентаризации рядом со значением из маркировки */
.from-file {
  margin-left: 8px; padding: 1px 7px; border-radius: 20px;
  font-size: 11.5px; color: var(--amber);
  background: #fdf3e0; border: 1px solid #f0dcb4;
}



/* неполный запрос: обозначения на выбор */
.choices { display: flex; flex-wrap: wrap; gap: 6px; }
.choice {
  font: inherit; font-size: 13px; padding: 5px 10px; cursor: pointer;
  border: 1px solid #c3cbd6; border-radius: 4px; background: #fff; color: #1b3a63;
}
.choice:hover { background: #eef4fb; border-color: #7aa4d6; }

/* имя файла прайса под названием поставщика */
.price-file {
  display: block; margin-top: 2px; font-size: 11px; line-height: 1.3;
  color: #6b7785; font-weight: normal;
}
