/* Общие стили инструментов сервисных сайтов nopobig.
   Правятся только здесь и раскатываются на все проекты (ops\deploy_engines.py).
   Пастельная гамма, без эмодзи, светлая и тёмная схемы. */

.np-tool {
  --np-bg: #fbfaf8;
  --np-card: #ffffff;
  --np-line: #e6e2db;
  --np-text: #2f2c28;
  --np-muted: #7a736a;
  --np-accent: #6f8f7d;
  --np-accent-soft: #eef3ef;
  --np-warn: #a8784f;
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--np-text);
  background: var(--np-bg);
  border: 1px solid var(--np-line);
  border-radius: 12px;
  padding: 20px;
  margin: 0 0 28px;
}

@media (prefers-color-scheme: dark) {
  .np-tool {
    --np-bg: #1e1d1b;
    --np-card: #262523;
    --np-line: #3a3835;
    --np-text: #ece8e2;
    --np-muted: #a49c92;
    --np-accent: #8fb09c;
    --np-accent-soft: #2b332e;
  }
}

.np-tool__head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.np-tool__title { font-size: 18px; font-weight: 600; margin: 0; }
.np-tool__note { color: var(--np-muted); font-size: 13px; margin: 0; }

.np-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.np-field { display: flex; flex-direction: column; gap: 4px; }
.np-field label { font-size: 14px; font-weight: 500; }
.np-field input, .np-field select {
  font: inherit; padding: 9px 11px; border: 1px solid var(--np-line);
  border-radius: 8px; background: var(--np-card); color: inherit; width: 100%;
}
.np-field input:focus, .np-field select:focus { outline: 2px solid var(--np-accent); outline-offset: 1px; }
.np-field__hint { font-size: 12px; color: var(--np-muted); }
.np-field__err { font-size: 12px; color: var(--np-warn); }

.np-result { margin-top: 18px; background: var(--np-card); border: 1px solid var(--np-line); border-radius: 10px; padding: 16px; }
.np-result__main { display: flex; flex-wrap: wrap; gap: 22px; }
.np-result__item { min-width: 150px; }
.np-result__label { font-size: 13px; color: var(--np-muted); }
.np-result__value { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; }
.np-result__value--small { font-size: 18px; font-weight: 500; }

.np-steps { margin: 16px 0 0; border-top: 1px solid var(--np-line); padding-top: 12px; }
.np-steps summary { cursor: pointer; font-size: 14px; color: var(--np-accent); }
.np-steps table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 14px; }
.np-steps th, .np-steps td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--np-line); }
.np-steps td:last-child, .np-steps th:last-child { text-align: right; white-space: nowrap; }

.np-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.np-actions button {
  font: inherit; font-size: 14px; padding: 8px 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--np-line); background: var(--np-card); color: inherit;
}
.np-actions button:hover { background: var(--np-accent-soft); border-color: var(--np-accent); }
.np-actions button:focus-visible { outline: 2px solid var(--np-accent); outline-offset: 1px; }

.np-source { margin-top: 12px; font-size: 13px; color: var(--np-muted); }
.np-source a { color: inherit; }

.np-notes { margin: 12px 0 0; padding: 0 0 0 18px; font-size: 13px; color: var(--np-muted); }

/* Таблица-фильтр (E2) */
.np-table__controls { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.np-table__controls input, .np-table__controls select {
  font: inherit; padding: 8px 10px; border: 1px solid var(--np-line);
  border-radius: 8px; background: var(--np-card); color: inherit;
}
.np-table__wrap { overflow-x: auto; }
.np-table table { width: 100%; border-collapse: collapse; font-size: 15px; background: var(--np-card); }
.np-table th, .np-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--np-line); }
.np-table th { cursor: pointer; white-space: nowrap; font-weight: 600; }
.np-table tr:target, .np-table tr.is-hit { background: var(--np-accent-soft); }
.np-table__empty { padding: 14px; color: var(--np-muted); font-size: 14px; }

/* Определитель (E3) */
.np-lookup__answer { margin-top: 16px; }
.np-lookup__card { background: var(--np-card); border: 1px solid var(--np-line); border-radius: 10px; padding: 14px; }
.np-lookup__card dl { display: grid; grid-template-columns: minmax(120px, 30%) 1fr; gap: 6px 14px; margin: 0; font-size: 15px; }
.np-lookup__card dt { color: var(--np-muted); }
.np-lookup__card dd { margin: 0; }

.np-table__controls input[type="search"] { min-width: 240px; flex: 1 1 240px; }
/* 🔴🔴 Выпадающий список тянется по САМОМУ ДЛИННОМУ варианту. У фильтра разделов
   ОКВЭД подписи вроде «A — Сельское, лесное хозяйство, охота…» распёрли страницу
   на 757 px вбок. Ширину режем здесь, а не подписями: подписи нужны читателю. */
.np-table__controls select { max-width: 100%; }
@media (min-width: 640px) { .np-table__controls select { max-width: 320px; } }
.np-table__controls button, .np-table__more button {
  font: inherit; font-size: 14px; padding: 8px 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--np-line); background: var(--np-card); color: inherit;
}
.np-table__controls button:hover, .np-table__more button:hover { background: var(--np-accent-soft); border-color: var(--np-accent); }
.np-table__more { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.np-table th[aria-sort="ascending"], .np-table th[aria-sort="descending"] { color: var(--np-accent); }

/* Определитель (E3): список похожих и подбор по модели */
.np-lookup__list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.np-lookup__hit {
  font: inherit; text-align: left; display: flex; gap: 12px; align-items: baseline;
  padding: 9px 12px; border: 1px solid var(--np-line); border-radius: 8px;
  background: var(--np-card); color: inherit; cursor: pointer;
}
.np-lookup__hit:hover { background: var(--np-accent-soft); border-color: var(--np-accent); }
.np-lookup__hit-code { font-weight: 600; min-width: 72px; font-variant-numeric: tabular-nums; }

/* Календарь (E4) */
.np-cal { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-top: 18px; }
.np-cal__month { background: var(--np-card); border: 1px solid var(--np-line); border-radius: 10px; padding: 12px; }
.np-cal__name { margin: 0 0 8px; font-weight: 600; font-size: 15px; text-transform: capitalize; }
/* 🔴 minmax(0,1fr), а не 1fr: иначе широкая ячейка распирает сетку вбок */
.np-cal__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; font-size: 13px; }
.np-cal__wd { text-align: center; color: var(--np-muted); font-size: 11px; padding: 2px 0; }
.np-cal__day, .np-cal__pad { text-align: center; padding: 5px 0; border-radius: 6px; font-variant-numeric: tabular-nums; }
.np-cal__day.is-off { background: var(--np-accent-soft); color: var(--np-warn); }
.np-cal__day.is-short { box-shadow: inset 0 -2px 0 var(--np-accent); }
.np-cal__sum { margin: 8px 0 0; font-size: 12px; color: var(--np-muted); }
.np-cal__table { width: 100%; border-collapse: collapse; margin-top: 18px; font-size: 14px; }
.np-cal__table th, .np-cal__table td { text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--np-line); }
.np-cal__table th:first-child, .np-cal__table td:first-child { text-align: left; text-transform: capitalize; }

/* Сборщик текста (E5) */
.np-build__out { margin-top: 18px; }
.np-build__text {
  background: var(--np-card); border: 1px solid var(--np-line); border-radius: 10px;
  padding: 16px 18px; font-size: 16px; line-height: 1.7;
}
.np-build__text p { margin: 0 0 12px; }
.np-build__text p:last-child { margin-bottom: 0; }

/* Опросник (E6) — блок внутри статьи, поэтому уже и спокойнее остальных инструментов */
.np-poll { max-width: 640px; padding: 18px 20px; }
.np-poll__q { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.4; }
.np-poll__head { margin-bottom: 14px; }
.np-poll__head .np-tool__note { margin-top: 6px; }

.np-poll__opts { display: flex; flex-direction: column; gap: 8px; }
.np-poll__opt {
  display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
  padding: 10px 12px; border: 1px solid var(--np-line); border-radius: 8px;
  background: var(--np-card); font-size: 15px; line-height: 1.4;
}
.np-poll__opt:hover { background: var(--np-accent-soft); border-color: var(--np-accent); }
.np-poll__opt input { margin: 2px 0 0; flex: none; accent-color: var(--np-accent); }
.np-poll__opt:focus-within { outline: 2px solid var(--np-accent); outline-offset: 1px; }

.np-poll__res { display: flex; flex-direction: column; gap: 8px; }
/* Полоса лежит ПОД текстом отдельным слоем: цветной фон под буквами всегда
   проигрывает по контрасту, а так текст читается при любой длине полосы. */
.np-poll__row {
  position: relative; border: 1px solid var(--np-line); border-radius: 8px;
  background: var(--np-card); overflow: hidden;
}
.np-poll__bar {
  position: absolute; inset: 0 auto 0 0; background: var(--np-accent-soft);
  transition: width .35s ease;
}
.np-poll__row-in {
  position: relative; display: flex; justify-content: space-between; gap: 14px;
  padding: 10px 12px; font-size: 15px; line-height: 1.4;
}
.np-poll__row.is-mine { border-color: var(--np-accent); }
.np-poll__row.is-mine .np-poll__text { font-weight: 600; }
.np-poll__pct { font-variant-numeric: tabular-nums; color: var(--np-muted); white-space: nowrap; }
.np-poll__row.is-mine .np-poll__pct { color: var(--np-accent); }

.np-poll__foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.np-poll__sum { margin: 0; font-size: 13px; color: var(--np-muted); }
.np-poll__send {
  font: inherit; font-size: 14px; padding: 8px 16px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--np-accent); background: var(--np-accent-soft); color: inherit;
}
.np-poll__link {
  font: inherit; font-size: 13px; padding: 0; border: none; background: none;
  color: var(--np-accent); cursor: pointer; text-decoration: underline;
}
.np-poll__link:hover { text-decoration: none; }
.np-poll__send:focus-visible, .np-poll__link:focus-visible { outline: 2px solid var(--np-accent); outline-offset: 2px; }

@media print {
  .np-actions, .np-tool__note, .np-table__controls, .np-table__more, .np-poll { display: none; }
  .np-tool { border: none; padding: 0; background: none; }
  .np-cal { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
