/* Anima КП — веб-морда kp_calc. Палитра = config.format (title_bg 2D4A6B, section 4A7BA4). */
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', Calibri, sans-serif; font-size: 15px;
       color: #1a1a1a; background: #f2f4f7; }
nav { display: flex; align-items: center; gap: 18px; padding: 10px 22px;
      background: #2D4A6B; color: #fff; flex-wrap: wrap; }
nav a { color: #dce6f2; text-decoration: none; }
nav a:hover { color: #fff; }
nav a.accent { background: #4A7BA4; padding: 4px 12px; border-radius: 6px; color: #fff; }
/* текущий раздел в верхнем меню */
nav a.nav-on { background: rgba(255,255,255,.18); padding: 4px 12px; border-radius: 6px;
      color: #fff; font-weight: 600; }
nav a.accent.nav-on { outline: 2px solid #fff; }
nav .brand { font-weight: 700; flex: 0 0 auto; }
nav .spacer { flex: 1; }
nav .who { color: #b8c9dd; }
nav a.who:hover { color: #fff; text-decoration: underline; }
main { width: 100%; max-width: 1400px; min-width: 0; margin: 24px auto; padding: 0 22px; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
.muted { color: #808080; font-weight: 400; }
.error { color: #B8290E; font-weight: 600; background: #fdeeea; padding: 8px 12px; border-radius: 6px; }
.ok { color: #1d6f42; font-weight: 600; background: #e8f5ec; padding: 8px 12px; border-radius: 6px; }
.badge { background: #B8290E; color: #fff; border-radius: 10px; padding: 1px 8px; font-size: 12px; }
.card { background: #fff; border: 1px solid #dfe3e8; border-radius: 8px; padding: 16px 18px; margin: 14px 0; }
.card.center { text-align: center; padding: 40px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .grid2 { grid-template-columns: 1fr; } }
label { display: block; margin: 10px 0; font-weight: 600; }
input, textarea, select { width: 100%; padding: 7px 10px; margin-top: 4px; font: inherit;
  border: 1px solid #c4ccd4; border-radius: 6px; background: #fff; }
textarea.mono, pre.summary { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
pre.summary { background: #f7f9fb; border: 1px solid #e3e8ee; border-radius: 6px;
  padding: 10px 12px; white-space: pre-wrap; }
pre.issues { background: #fff8e6; }
.btn { display: inline-block; padding: 8px 16px; border: 1px solid #c4ccd4; border-radius: 6px;
  background: #fff; font: inherit; cursor: pointer; text-decoration: none; color: #1a1a1a; }
.btn:hover { background: #f0f3f6; }
.btn.primary { background: #4A7BA4; border-color: #4A7BA4; color: #fff; }
.btn.primary:hover { background: #3d688c; }
.btn.primary:disabled { background: #9db4c8; border-color: #9db4c8; cursor: not-allowed; }
.btn.danger { background: #B8290E; border-color: #B8290E; color: #fff; }
.btn.danger:hover { background: #96210c; border-color: #96210c; }
.btn.big { font-size: 17px; padding: 10px 26px; }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible,
button:focus-visible, a:focus-visible { outline: 3px solid #8AB8DE; outline-offset: 2px; }
button.link { background: none; border: none; color: #0563C1; cursor: pointer; font: inherit;
  text-decoration: underline; padding: 0; }
.danger-link { color: #9f260f !important; }
form.inline { display: inline; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.row-action { width: 1%; white-space: nowrap; text-align: end; }
.record-actions { display: flex; align-items: flex-start; gap: 18px; flex-wrap: wrap;
  margin: 18px 0; }
.danger-zone { max-width: 720px; margin: 28px 0 0; padding-top: 12px;
  border-top: 1px solid #d9dee4; color: #4b5660; }
.danger-zone summary { width: fit-content; color: #9f260f; font-weight: 600; }
.danger-zone p { max-width: 68ch; line-height: 1.45; }
.inline-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline-row input, .inline-row select { width: auto; margin: 0; }
.inline-row .radio { display: inline-flex; align-items: center; gap: 4px; font-weight: 400; margin: 0; }
.inline-row .radio input { width: auto; }
.toolbar { margin: 12px 0; display: flex; gap: 10px; }
.filters { margin: 10px 0 16px; display: flex; gap: 6px; flex-wrap: wrap; }
.filters a { padding: 4px 12px; border-radius: 14px; background: #e4e9ef; color: #33475b;
  text-decoration: none; font-size: 13px; }
.filters a.on { background: #2D4A6B; color: #fff; }
table.list { border-collapse: collapse; background: #fff; width: 100%; }
table.list th { background: #4A7BA4; color: #fff; padding: 7px 10px; text-align: left; }
table.list td { border: 1px solid #e0e5ea; padding: 6px 10px; }
table.list tr:nth-child(even) td { background: #f7f9fb; }
.scroll { width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; }
.list-scroll table.list { min-width: 720px; }
.order-list-scroll table.list { min-width: 900px; }
.list-scroll:focus-visible { outline: 3px solid #8AB8DE; outline-offset: 2px; }
.status-line { font-size: 16px; }

/* Строгий Excel-импорт клиентов */
.page-head { display: flex; align-items: flex-start; justify-content: space-between;
  gap: 18px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head h1, .page-head h2 { margin: 0 0 6px; }
.page-head.compact { align-items: center; margin-top: 26px; }
.import-lead { max-width: 72ch; margin: 0; color: #4d5c69; line-height: 1.5; }
.import-steps { counter-reset: import-step; list-style: none; margin: 18px 0;
  padding: 0; background: #fff; border: 1px solid #dfe3e8; border-radius: 8px; }
.import-steps li { counter-increment: import-step; display: grid;
  grid-template-columns: 30px minmax(180px, 260px) 1fr auto; gap: 12px;
  align-items: center; padding: 14px 18px; border-bottom: 1px solid #e4e8ed; }
.import-steps li > * { min-width: 0; }
.import-steps li:last-child { border-bottom: 0; }
.import-steps li::before { content: counter(import-step); width: 26px; height: 26px;
  display: grid; place-items: center; border-radius: 50%; background: #2D4A6B;
  color: #fff; font-size: 13px; font-weight: 700; }
.import-steps span { color: #5c6975; line-height: 1.4; }
.import-upload { max-width: 760px; }
.import-upload input[type=file] { padding: 10px; background: #f7f9fb; }
.import-upload .muted, .import-preview .muted { color: #5f6871; }
.import-summary { display: flex; gap: 8px; flex-wrap: wrap; }
.import-count, .import-state { display: inline-flex; align-items: center; gap: 4px;
  border-radius: 14px; padding: 4px 10px; font-size: 13px; white-space: nowrap; }
.import-count.new, .import-state.new { background: #e8f5ec; color: #1d6f42; }
.import-count.exists, .import-state.exists { background: #e7edf3; color: #42566a; }
.import-count.error-state, .import-state.error { background: #fdeeea; color: #9f260f; }
.import-table { min-width: 900px; }
.import-table-scroll:focus-visible { outline: 3px solid #8AB8DE; outline-offset: 2px; }
.import-table td { vertical-align: top; }
.import-table td.num { width: 70px; text-align: right; font-variant-numeric: tabular-nums; }
.import-table tr.import-row-error td { background: #fff7f5; }
.import-table tr.import-row-new td { background: #fbfefc; }
.import-message { display: block; margin: 5px 0 3px; color: #53616e; }
.import-confirm { display: flex; align-items: center; justify-content: space-between;
  gap: 24px; margin-top: 18px; }
.import-confirm h2, .import-confirm p { margin: 0 0 6px; }
@media (max-width: 760px) {
  .import-steps li { grid-template-columns: 30px 1fr; align-items: start; }
  .import-steps li span, .import-steps li .btn { grid-column: 2; }
  .import-steps li .btn { width: 100%; text-align: center; }
  .import-confirm { align-items: stretch; flex-direction: column; }
  .import-confirm .btn { width: 100%; text-align: center; }
}

.login-box { max-width: 360px; margin: 80px auto; background: #fff; padding: 28px;
  border-radius: 10px; border: 1px solid #dfe3e8; }
.spinner { width: 36px; height: 36px; margin: 0 auto 14px; border: 4px solid #dbe4ec;
  border-top-color: #4A7BA4; border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
details { margin-top: 12px; }
details summary { cursor: pointer; color: #0563C1; }
.actions form { margin-right: 12px; }
.actions input { width: 140px; }

/* витрина выбора доставки (страница заказа) */
table.pick-table { border-collapse: collapse; background: #fff; margin: 6px 0 14px; }
table.pick-table th { background: #4A7BA4; color: #fff; padding: 6px 10px; text-align: left; }
table.pick-table td { border: 1px solid #e0e5ea; padding: 5px 10px; }
table.pick-table td.num { text-align: right; }
table.pick-table tr.picked td { background: #E2EFDA; font-weight: 600; }
/* Свёрнутые варианты доставки: в строке-сводке стои́т то, что заложено в цену. */
details.pick-fold { margin: 6px 0 14px; }
details.pick-fold > summary { color: #1a1a1a; padding: 7px 10px; background: #E2EFDA;
  border: 1px solid #cfe0c2; border-radius: 6px; }
details.pick-fold > summary:hover { background: #d8ebcb; }
details.pick-fold > summary .muted { color: #5b6b52; }

/* энциклопедия: превью файлов карточки */
.thumbs { display: flex; gap: 12px; flex-wrap: wrap; }
.thumb { text-align: center; }
.thumb img { max-width: 180px; max-height: 180px; border: 1px solid #e0e5ea; border-radius: 6px;
  display: block; margin-bottom: 4px; }

/* ползунок диапазона плотности в справочнике тканей */
.range-box { display: inline-flex; align-items: center; gap: 10px; background: #fff;
  border: 1px solid #c4ccd4; border-radius: 6px; padding: 6px 12px; flex-wrap: wrap; }
.range-box label { display: inline-flex; align-items: center; gap: 6px; margin: 0;
  font-weight: 400; color: #555; }
.range-box input[type=range] { width: 140px; margin: 0; }

/* тендерный контур: описание закупки, документы, трек образца */
table.kv { border-collapse: collapse; background: #fff; width: 100%; }
table.kv th { text-align: left; vertical-align: top; padding: 5px 12px 5px 0; color: #555;
  font-weight: 600; white-space: nowrap; width: 220px; border-bottom: 1px solid #eef1f4; }
table.kv td { padding: 5px 0; border-bottom: 1px solid #eef1f4; }
.doc-list { margin: 8px 0; padding-left: 20px; }
.doc-list li { margin: 3px 0; }
.stage { display: inline-block; padding: 3px 8px; border-radius: 6px; background: #f0f3f6;
  color: #777; margin: 2px 0; }
.stage.stage-done { background: #E2EFDA; color: #1c6b31; font-weight: 600; }

/* экран «Поиск в Китае» */
.china-tabs { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.china-tabs label { font-weight: normal; }
.china-filters { border-left: 3px solid #e5e5e5; padding-left: 12px; margin: 8px 0; }
.china-filters .f-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.china-filters .f-row input[type=text], .china-filters .f-row input:not([type]) { flex: 1 1 220px; }
.china-filters label.f-on { font-weight: normal; white-space: nowrap; margin: 0; }
.china-filters .f-hint { margin: 2px 0 10px 22px; font-size: 12px; }
.suggest { display: block; margin: 2px 0; }
.landed { background: #f4f9f4; border-left: 3px solid #7ab87a; padding: 6px 10px; }
/* карточка результата — фото слева, данные справа */
.china-row { display: flex; gap: 14px; align-items: flex-start; }
.china-row img.thumb { width: 120px; height: 120px; object-fit: cover; flex: 0 0 auto; }
.china-row h3 { margin: 0 0 4px; font-size: 15px; }
.china-row p { margin: 4px 0; }
@media (max-width: 600px) { .china-row { flex-direction: column; } }

/* пояснение при наведении (нативная подсказка браузера — без скриптов) */
.hint-hover { cursor: help; border-bottom: 1px dotted var(--muted, #999); }
.hint-mark {
  display: inline-block; width: 15px; height: 15px; line-height: 15px;
  text-align: center; border-radius: 50%; background: #e8e8e8; color: #555;
  font-size: 11px; font-weight: 600; margin-left: 2px;
}
/* расшифровка расчёта ввоза */
.landed table { width: auto; min-width: 60%; }
.landed td { padding: 3px 18px 3px 0; }
.landed td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Светофор заказа (Ф-12, блок 1Д) ────────────────────────────────────── */
.svetofor { padding: 12px 16px; }
.stage-line { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.stage-chip { padding: 4px 10px; border: 1px solid #d6d6d6; border-radius: 14px;
  background: #f5f5f5; color: #777; font-size: 13px; white-space: nowrap; }
.stage-chip.on { background: #2c4a7c; border-color: #2c4a7c; color: #fff; font-weight: 600; }
.stage-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.stale { color: #B7791F; font-weight: 600; font-size: 13px; }
.filters-tech { margin: -6px 0 12px; }
.filters-tech summary { cursor: pointer; font-size: 13px; }
.filters-tech a { margin-right: 10px; font-size: 13px; }

/* ── Карточка заказа: метки происхождения (Ф-32) ────────────────────────── */
.card-grid-wrap { overflow-x: auto; overscroll-behavior-inline: contain; }
.card-grid { table-layout: fixed; width: 100%; min-width: 720px; }
.card-grid col.card-label { width: 42%; }
.card-grid col.card-origin { width: 170px; }
.card-grid td { vertical-align: top; padding: 5px 10px; overflow-wrap: anywhere; }
.card-grid th { background: #f0f3f7; text-align: left; padding: 6px 10px; }
.small { font-size: 12px; }
.mk { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px;
  white-space: nowrap; cursor: help; }
.mk-from_tz   { background: #e3f0e3; color: #2d6a2d; }   /* вычитано из документа */
.mk-manager   { background: #e5eefb; color: #23548f; }   /* вписал человек */
.mk-engine    { background: #fdf1dc; color: #8a5d10; }   /* догадка движка */
.mk-confirmed { background: #2d6a2d; color: #fff; }      /* человек подтвердил */
.assumptions { background: #fdf6e7; border-left: 3px solid #d9a441; padding: 8px 14px;
  margin-top: 12px; }
.assumptions ul { margin: 6px 0 0; padding-left: 20px; }

/* ── Уточняющие вопросы (Ф-33) ──────────────────────────────────────────── */
.questions { border-left: 3px solid #d9a441; }
.q-row { display: flex; gap: 16px; align-items: flex-start; padding: 8px 0;
  border-bottom: 1px solid #eee; }
.q-ask { flex: 1 1 auto; }
.q-input { flex: 0 0 240px; }
.q-input input, .q-input select { width: 100%; }
@media (max-width: 640px) { .q-row { flex-direction: column; } .q-input { flex: 1 1 auto; width: 100%; } }

/* Страница задания (Ф-44…Ф-45): фотографии смотрятся не скачивая. */
.task-main { margin: 6px 0 10px; }
.task-main img { max-width: 100%; max-height: 60vh; border-radius: 6px; border: 1px solid #e3e7ec; }
.task-tiles { display: flex; flex-wrap: wrap; gap: 10px; }
.task-tiles figure { margin: 0; width: 150px; text-align: center; }
.task-tiles img { width: 150px; height: 150px; object-fit: cover; border-radius: 6px;
  border: 1px solid #e3e7ec; }
.task-shot { cursor: zoom-in; }
.task-text { white-space: pre-wrap; word-break: break-word; font-family: inherit;
  font-size: 14px; margin: 0; max-height: 60vh; overflow: auto; }
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(17, 20, 24, .92);
  display: flex; align-items: center; justify-content: center; gap: 10px; }
.lightbox.hidden { display: none; }
.lightbox img { max-width: 88vw; max-height: 88vh; object-fit: contain; }
.lightbox button { background: rgba(255, 255, 255, .12); color: #fff; border: 0;
  font-size: 30px; line-height: 1; padding: 10px 16px; border-radius: 6px; cursor: pointer; }
.lightbox button:hover { background: rgba(255, 255, 255, .24); }
.lb-close { position: absolute; top: 16px; right: 20px; font-size: 22px; }
@media (max-width: 640px) {
  .task-tiles figure, .task-tiles img { width: 104px; }
  .task-tiles img { height: 104px; }
  .lightbox button { font-size: 22px; padding: 8px 12px; }
}

/* Правка себестоимости (Ф-37…Ф-40) */
tr.row-hole { background: #fff4f2; }
tr.row-changed { background: #f2f8ff; }
tr.row-changed td:first-child { border-left: 3px solid #4A7BA4; }
