/* Виджет подбора кода ТН ВЭД — минималистичный квиз. Префикс tnw- во избежание
   конфликтов со стилями сайта. */
.tnw-root {
  --tnw-accent: #1f6feb;
  --tnw-accent-dark: #1a5fd0;
  --tnw-bg: #ffffff;
  --tnw-text: #1a2230;
  --tnw-muted: #6b7683;
  --tnw-border: #e5e9f0;
  --tnw-radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--tnw-text);
  box-sizing: border-box;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}
.tnw-root *, .tnw-root *::before, .tnw-root *::after { box-sizing: border-box; }

.tnw-card {
  background: var(--tnw-bg);
  border: 1px solid var(--tnw-border);
  border-radius: var(--tnw-radius);
  padding: 32px 28px;
  min-height: 320px;
  display: flex;
  flex-direction: column;
}

.tnw-progress { height: 4px; background: var(--tnw-border); border-radius: 4px; margin-bottom: 24px; overflow: hidden; }
.tnw-progress-bar { height: 100%; background: var(--tnw-accent); width: 0; transition: width .3s ease; }

.tnw-step { flex: 1; display: flex; flex-direction: column; }
.tnw-title { font-size: 22px; font-weight: 700; line-height: 1.3; margin: 0 0 8px; }
.tnw-subtitle { font-size: 15px; color: var(--tnw-muted); margin: 0 0 20px; line-height: 1.5; }
.tnw-hint { font-size: 13px; color: var(--tnw-muted); margin-top: 8px; }

.tnw-input, .tnw-textarea {
  width: 100%; font-size: 16px; color: var(--tnw-text);
  padding: 14px 16px; border: 1px solid var(--tnw-border); border-radius: 10px;
  outline: none; transition: border-color .15s; font-family: inherit;
}
.tnw-input:focus, .tnw-textarea:focus { border-color: var(--tnw-accent); }
.tnw-textarea { resize: vertical; min-height: 96px; }

.tnw-actions { display: flex; gap: 10px; margin-top: 22px; align-items: center; flex-wrap: wrap; }
.tnw-btn {
  appearance: none; border: none; cursor: pointer; font-family: inherit;
  font-size: 15px; font-weight: 600; padding: 12px 22px; border-radius: 10px;
  background: var(--tnw-accent); color: #fff; transition: background .15s, transform .05s;
}
.tnw-btn:hover { background: var(--tnw-accent-dark); }
.tnw-btn:active { transform: translateY(1px); }
.tnw-btn:disabled { opacity: .5; cursor: default; }
.tnw-btn--ghost { background: transparent; color: var(--tnw-muted); }
.tnw-btn--ghost:hover { background: #f4f6fa; color: var(--tnw-text); }
.tnw-btn--outline { background: #fff; color: var(--tnw-accent); border: 1px solid var(--tnw-accent); }
.tnw-btn--outline:hover { background: #f0f6ff; }
.tnw-btn--block { width: 100%; }

.tnw-options { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.tnw-option {
  text-align: left; padding: 14px 16px; border: 1px solid var(--tnw-border);
  border-radius: 10px; background: #fff; cursor: pointer; font-size: 15px;
  color: var(--tnw-text); font-family: inherit; transition: border-color .15s, background .15s;
}
.tnw-option:hover { border-color: var(--tnw-accent); background: #f7faff; }
.tnw-chips { display: flex; gap: 10px; flex-wrap: wrap; }
.tnw-chip { padding: 12px 20px; border: 1px solid var(--tnw-border); border-radius: 10px; background: #fff; cursor: pointer; font-size: 15px; font-weight: 600; }
.tnw-chip:hover { border-color: var(--tnw-accent); background: #f7faff; }

/* результат */
.tnw-code { font-size: 26px; font-weight: 800; letter-spacing: .5px; }
.tnw-desc { font-size: 14px; color: var(--tnw-muted); margin: 6px 0 16px; line-height: 1.5; }
.tnw-block { border: 1px solid var(--tnw-border); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; }
.tnw-block h4 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--tnw-muted); }
.tnw-row { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; padding: 3px 0; }
.tnw-row b { font-weight: 700; }
.tnw-list { margin: 0; padding-left: 18px; font-size: 14px; }
.tnw-warn { background: #fff6e5; border-color: #ffe0a3; color: #8a5b00; }
.tnw-total { font-size: 18px; font-weight: 800; }
.tnw-disclaimer { font-size: 12px; color: var(--tnw-muted); margin-top: 14px; line-height: 1.5; }

.tnw-loader { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; color: var(--tnw-muted); }
.tnw-spinner { width: 36px; height: 36px; border: 3px solid var(--tnw-border); border-top-color: var(--tnw-accent); border-radius: 50%; animation: tnw-spin 1s linear infinite; }
@keyframes tnw-spin { to { transform: rotate(360deg); } }

.tnw-error { color: #b3261e; font-size: 15px; }

/* модалка (embed) */
.tnw-modal-overlay { position: fixed; inset: 0; background: rgba(20,28,40,.55); display: flex; align-items: center; justify-content: center; z-index: 999999; padding: 16px; }
.tnw-modal { position: relative; width: 100%; max-width: 680px; max-height: 92vh; overflow-y: auto; background: #fff; border-radius: 16px; padding: 8px; }
.tnw-modal-close { position: absolute; top: 12px; right: 14px; z-index: 2; border: none; background: transparent; font-size: 26px; line-height: 1; cursor: pointer; color: var(--tnw-muted); }

/* плавающая кнопка (bubble) — слева снизу, чтобы не конфликтовать с JivoChat справа */
.tnw-bubble {
  position: fixed; left: 20px; bottom: 20px; z-index: 999998;
  background: var(--tnw-accent); color: #fff; border: none; cursor: pointer;
  padding: 14px 20px; border-radius: 30px; font-size: 15px; font-weight: 700;
  box-shadow: 0 6px 20px rgba(31,111,235,.35); font-family: inherit;
}
.tnw-bubble:hover { background: var(--tnw-accent-dark); }

@media (max-width: 520px) {
  .tnw-card { padding: 24px 18px; }
  .tnw-title { font-size: 19px; }
  .tnw-bubble { left: 12px; bottom: 12px; padding: 12px 16px; font-size: 14px; }
}
