@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --ink: #0f0f0e;
  --ink2: #3a3935;
  --ink3: #7a7870;
  --ink4: #b0ae a6;
  --paper: #faf9f6;
  --paper2: #f2f0eb;
  --paper3: #e8e5de;
  --line: #dddad3;
  --green: #1c4f3b;
  --green2: #2d7a57;
  --green3: #e6f2ec;
  --red: #b83232;
  --amber: #b86b1c;
  --blue: #1c3f6e;
  --r: 8px;
  --r-sm: 5px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── HEADER ── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(250,249,246,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1020px; margin: 0 auto;
  padding: 0 2rem;
  height: 60px;
  display: flex; align-items: center; justify-content: space-between;
}
.site-logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 18px; }
.logo-text {
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: 1.15rem; font-weight: 500;
  letter-spacing: 0.02em; color: var(--ink);
}
.site-nav { display: flex; gap: 1.75rem; }
.site-nav a {
  font-size: 0.8rem; font-weight: 500;
  color: var(--ink3); text-decoration: none;
  letter-spacing: 0.04em; text-transform: uppercase;
  transition: color 0.2s;
}
.site-nav a:hover { color: var(--ink); }

/* ── HERO ── */
.hero {
  max-width: 1020px; margin: 0 auto;
  padding: 4rem 2rem 2.5rem;
  border-bottom: 1px solid var(--line);
}
.hero-label {
  font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--green2); margin-bottom: 1rem;
}
.hero h1 {
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 300; line-height: 1.2;
  color: var(--ink); margin-bottom: 1rem;
  max-width: 640px;
}
.hero p {
  font-size: 0.9rem; color: var(--ink3);
  max-width: 520px; line-height: 1.7;
}

/* ── LAYOUT ── */
.calc-layout {
  max-width: 1020px; margin: 0 auto;
  padding: 2.5rem 2rem;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 2rem;
  align-items: start;
}
@media(max-width: 820px) {
  .calc-layout { grid-template-columns: 1fr; }
  .result-sticky { position: static !important; }
}

/* ── RATES BAR ── */
.rates-bar {
  grid-column: 1 / -1;
  background: var(--ink);
  border-radius: var(--r);
  padding: 1rem 1.5rem;
  display: flex; align-items: center; gap: 2.5rem; flex-wrap: wrap;
}
.rate-item .rate-label {
  font-size: 0.65rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: rgba(255,255,255,0.45);
}
.rate-item .rate-val {
  font-size: 1rem; font-weight: 600;
  color: #fff; margin-top: 1px;
}
.rate-item .rate-sub { font-size: 0.68rem; color: rgba(255,255,255,0.35); }
.refresh-btn {
  margin-left: auto;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.8);
  border-radius: var(--r-sm);
  padding: 7px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem; cursor: pointer;
  transition: background 0.2s;
}
.refresh-btn:hover { background: rgba(255,255,255,0.18); }

/* ── SECTION CARD ── */
.section-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}
.section-title {
  font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--green); margin-bottom: 1.25rem;
  display: flex; align-items: center; gap: 8px;
}
.section-title::before {
  content: '';
  display: block; width: 3px; height: 14px;
  background: var(--green); border-radius: 2px;
}

/* ── FORM ELEMENTS ── */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 1rem; }
.field:last-child { margin-bottom: 0; }
.field label {
  font-size: 0.76rem; font-weight: 500;
  color: var(--ink3);
}
.field label .req { color: var(--red); margin-left: 2px; }
.hint { font-size: 0.72rem; color: var(--ink4); margin-top: 3px; }

.input-row { display: flex; gap: 8px; align-items: stretch; }
.input-row .inp-main { flex: 1; }

input[type=text], input[type=number], select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
}
input:focus, select:focus {
  border-color: var(--green2);
  box-shadow: 0 0 0 3px rgba(45,122,87,0.1);
}
input[readonly] {
  background: var(--paper2);
  color: var(--ink3);
  cursor: default;
}
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; }

.pfx-wrap { display: flex; }
.pfx-wrap .pfx, .pfx-wrap .sfx {
  display: flex; align-items: center;
  padding: 0 10px;
  background: var(--paper2);
  border: 1px solid var(--line);
  font-size: 0.82rem; color: var(--ink3);
  white-space: nowrap; flex-shrink: 0;
}
.pfx-wrap .pfx { border-right: none; border-radius: var(--r-sm) 0 0 var(--r-sm); }
.pfx-wrap .sfx { border-left: none; border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.pfx-wrap input { border-radius: 0; }
.pfx-wrap input:only-child { border-radius: var(--r-sm); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.75rem; }
@media(max-width: 560px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
}

/* ── SEGMENTED CONTROL ── */
.seg {
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden; flex-shrink: 0;
}
.seg button {
  flex: 1; padding: 8px 6px;
  font-family: 'Inter', sans-serif;
  font-size: 0.76rem; font-weight: 500;
  border: none; background: #fff;
  color: var(--ink3); cursor: pointer;
  border-right: 1px solid var(--line);
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.seg button:last-child { border-right: none; }
.seg button.active { background: var(--green); color: #fff; }
.seg button:hover:not(.active) { background: var(--paper2); }

/* ── ТОВАРЫ (мультитовар) ── */
.goods-list { display: flex; flex-direction: column; gap: 1rem; }

.good-item {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--paper);
  overflow: hidden;
}
.good-header {
  display: flex; align-items: center;
  padding: 0.65rem 1rem;
  background: var(--paper2);
  border-bottom: 1px solid var(--line);
  gap: 8px;
}
.good-num {
  width: 22px; height: 22px;
  background: var(--green);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700;
  flex-shrink: 0;
}
.good-title-input {
  flex: 1;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  font-weight: 500;
  font-size: 0.85rem;
  padding: 0 !important;
  color: var(--ink);
}
.good-title-input:focus { box-shadow: none !important; border: none !important; }
.good-remove {
  background: none; border: none;
  color: var(--ink4); cursor: pointer;
  font-size: 1.1rem; line-height: 1;
  padding: 2px 4px;
  transition: color 0.15s;
}
.good-remove:hover { color: var(--red); }

.good-body { padding: 1rem; }

/* ── TNVED ── */
.tnved-code-input {
  font-family: 'Courier New', monospace !important;
  letter-spacing: 0.08em;
}
.tnved-found {
  margin-top: 8px; padding: 10px 12px;
  background: var(--green3);
  border: 1px solid #b5d9c5;
  border-radius: var(--r-sm);
  font-size: 0.8rem; display: none;
}
.tnved-found .tf-name { font-weight: 600; color: var(--green); margin-bottom: 3px; }
.tnved-found .tf-details { color: var(--ink3); }
.tnved-found .tf-details b { color: var(--ink); }
.tnved-miss {
  margin-top: 8px; padding: 8px 12px;
  background: #fdf3f0;
  border: 1px solid #f0c4b8;
  border-radius: var(--r-sm);
  font-size: 0.8rem; color: var(--red);
  display: none;
}

/* ── ADD ТОВАР ── */
.add-good-btn {
  width: 100%;
  padding: 0.75rem;
  background: none;
  border: 1.5px dashed var(--line);
  border-radius: var(--r);
  font-family: 'Inter', sans-serif;
  font-size: 0.84rem; font-weight: 500;
  color: var(--ink3);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.add-good-btn:hover {
  border-color: var(--green2);
  color: var(--green2);
  background: var(--green3);
}

/* ── CALCULATE BTN ── */
.calc-btn {
  width: 100%;
  padding: 1rem 1.5rem;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: var(--r);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem; font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  margin-top: 0.25rem;
}
.calc-btn:hover { background: var(--green2); }
.calc-btn:active { transform: scale(0.99); }

/* ── ERROR ── */
.err-box {
  background: #fdf3f0;
  border: 1px solid #f0c4b8;
  border-radius: var(--r-sm);
  padding: 0.75rem 1rem;
  font-size: 0.84rem;
  color: var(--red);
  margin-bottom: 1rem;
  display: none;
}

/* ── RESULT PANEL ── */
.result-sticky {
  position: sticky;
  top: 76px;
}
.result-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.result-head {
  background: var(--green);
  padding: 1.25rem 1.5rem;
  color: #fff;
}
.result-head .rh-label {
  font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  opacity: 0.65; margin-bottom: 0.35rem;
}
.result-head .rh-total {
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: 2.2rem; font-weight: 500;
  line-height: 1.1;
}
.result-head .rh-other {
  font-size: 0.78rem; opacity: 0.65;
  margin-top: 6px;
}

.result-empty {
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--ink4);
  font-size: 0.85rem;
  line-height: 1.8;
}
.result-empty .re-icon {
  font-size: 2rem; margin-bottom: 0.75rem;
  display: block; opacity: 0.3;
}

.res-body { padding: 0; }
.res-group-label {
  padding: 0.5rem 1.25rem;
  font-size: 0.65rem; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink3);
  background: var(--paper2);
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
}
.res-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0.65rem 1.25rem;
  border-bottom: 1px solid var(--line);
  gap: 8px;
}
.res-row:last-child { border-bottom: none; }
.res-row .rl { font-size: 0.8rem; color: var(--ink3); flex: 1; }
.res-row .rl small { display: block; font-size: 0.7rem; color: var(--ink4); margin-top: 1px; }
.res-row .ra { font-size: 0.85rem; font-weight: 600; color: var(--ink); text-align: right; white-space: nowrap; }
.res-row .ra small { display: block; font-size: 0.7rem; font-weight: 400; color: var(--ink3); }
.res-row.total-row { background: var(--green3); }
.res-row.total-row .rl { font-weight: 700; color: var(--ink); font-size: 0.88rem; }
.res-row.total-row .ra { font-size: 1rem; color: var(--green); }
.res-row.grand-row { background: var(--ink); }
.res-row.grand-row .rl { color: rgba(255,255,255,0.7); font-weight: 600; }
.res-row.grand-row .ra { color: #fff; font-size: 1.05rem; }

/* ── СТРУКТУРА ЗАТРАТ ── */
.cost-structure {
  padding: 1.25rem;
  border-top: 1px solid var(--line);
}
.cs-title {
  font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink3); margin-bottom: 0.75rem;
}
.bar-track {
  height: 8px; border-radius: 4px;
  overflow: hidden; display: flex;
  margin-bottom: 0.75rem;
  background: var(--paper3);
}
.bar-seg { height: 100%; transition: width 0.6s ease; }
.legend { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; }
.legend-item {
  display: flex; align-items: center; gap: 5px;
  font-size: 0.72rem; color: var(--ink3);
}
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ── EXPORT BUTTONS ── */
.export-btns {
  display: flex; gap: 0.75rem; flex-wrap: wrap;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--line);
}
.export-btn {
  flex: 1; min-width: 100px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem; font-weight: 600;
  color: var(--ink2);
  cursor: pointer;
  transition: all 0.15s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.export-btn:hover { border-color: var(--green2); color: var(--green); background: var(--green3); }
.export-btn.pdf { border-color: #d0401a; color: #b83222; }
.export-btn.pdf:hover { background: #fdf2ef; }
.export-btn.xlsx { border-color: #1a6b2a; color: #1a5c24; }
.export-btn.xlsx:hover { background: #edf7ef; }

/* ── FILENAME INPUT ── */
.filename-row {
  padding: 0 1.25rem 1rem;
  display: none;
}
.filename-row label {
  font-size: 0.72rem; color: var(--ink3);
  display: block; margin-bottom: 4px;
}

/* ── HOW SECTION ── */
.how-section {
  max-width: 1020px; margin: 0 auto;
  padding: 3rem 2rem;
  border-top: 1px solid var(--line);
}
.how-section h2 {
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: 1.8rem; font-weight: 300;
  margin-bottom: 2rem;
}
.how-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}
.how-item { }
.how-num {
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: 2.5rem; font-weight: 300;
  color: var(--line); line-height: 1;
  margin-bottom: 0.5rem;
}
.how-item h3 { font-size: 0.88rem; font-weight: 600; margin-bottom: 0.35rem; }
.how-item p { font-size: 0.82rem; color: var(--ink3); line-height: 1.6; }

/* ── FOOTER ── */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--paper2);
}
.footer-inner {
  max-width: 1020px; margin: 0 auto;
  padding: 1.5rem 2rem;
  font-size: 0.75rem; color: var(--ink3);
  line-height: 1.6;
}

/* ── OPTIONAL TAG ── */
.opt-tag {
  display: inline-block;
  font-size: 0.65rem; font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.06em; text-transform: uppercase;
  background: #e8f0ff; color: #2450a0;
  margin-left: 6px; vertical-align: middle;
}

/* ── ТОВАР SUMMARY (в результате) ── */
.goods-summary { padding: 0.75rem 1.25rem; border-bottom: 1px solid var(--line); }
.gs-item {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 0.78rem; padding: 3px 0;
}
.gs-item .gs-name { color: var(--ink3); }
.gs-item .gs-val { font-weight: 600; color: var(--ink); }

@media(max-width: 600px) {
  .hero { padding: 2.5rem 1rem 1.5rem; }
  .calc-layout { padding: 1.5rem 1rem; }
  .export-btns { flex-direction: column; }
}

/* ── РУЧНОЙ ВВОД КУРСОВ ── */
.rate-input {
  background: rgba(255,255,255,0.15) !important;
  border: 1px solid rgba(255,255,255,0.3) !important;
  border-radius: 5px !important;
  color: #fff !important;
  font-size: 1rem !important;
  font-weight: 600 !important;
  padding: 4px 8px !important;
  width: 90px !important;
  margin-top: 2px;
  font-family: 'Inter', sans-serif !important;
}
.rate-input:focus {
  outline: none !important;
  background: rgba(255,255,255,0.25) !important;
  box-shadow: none !important;
  border-color: rgba(255,255,255,0.6) !important;
}
.rate-input::placeholder { color: rgba(255,255,255,0.5); }
.rate-hint {
  margin-left: auto;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.45);
  align-self: center;
}

/* ── WIDER INPUTS ── */
.wide-input {
  min-width: 0;
}
input[type=number].wide-input,
input[type=text].wide-input {
  /* поля растягиваются по flex-контейнеру */
}
/* Поле поиска ТНВЭД — на всю ширину */
.tnved-search-input {
  width: 100%;
  font-size: 0.88rem;
}
/* Числовые инпуты не сжимаются */
#goodsVal1, #goodsVal2, #goodsVal3, #goodsVal4, #goodsVal5,
#weight1, #weight2, #weight3, #weight4, #weight5 {
  min-width: 120px;
}

/* ── TNVED SEARCH ── */
.tnved-search-wrap {
  position: relative;
}
.tnved-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  max-height: 280px;
  overflow-y: auto;
  z-index: 200;
}
.tnved-option {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--paper2);
  transition: background 0.1s;
}
.tnved-option:last-child { border-bottom: none; }
.tnved-option:hover { background: var(--green3); }
.to-code {
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  color: var(--green);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.to-name {
  font-size: 0.82rem;
  color: var(--ink);
  flex: 1;
  line-height: 1.3;
}
.to-duty {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--amber);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── TNVED FOUND (с кнопкой «Изменить») ── */
.tnved-found {
  position: relative;
}
.tnved-clear {
  margin-top: 6px;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 3px 10px;
  font-family: 'Inter', sans-serif;
  font-size: 0.74rem;
  color: var(--ink3);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.tnved-clear:hover { border-color: var(--green2); color: var(--green); }

/* ── МОБИЛЬНЫЕ ── */
@media(max-width: 600px) {
  .tnved-search-input { font-size: 16px; /* предотвращает зум на iOS */ }
  .grid2 { grid-template-columns: 1fr !important; }
}

/* ── ЛОГИСТИКА ПОДРАЗДЕЛЫ ── */
.log-sub {
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}
.log-sub:first-child { border-top: none; padding-top: 0; }
.log-sub-last { padding-bottom: 0; }
.log-sub-header {
  display: flex; align-items: baseline; gap: 8px;
  margin-bottom: 0.65rem;
}
.log-sub-name {
  font-size: 0.8rem; font-weight: 600;
  color: var(--ink2);
}
.log-sub-hint {
  font-size: 0.72rem; color: var(--ink3);
}
.log-mode-seg { max-width: 360px; }
.log-block .input-row { flex-wrap: wrap; gap: 8px; }
.log-block .pfx-wrap.inp-main { min-width: 160px; }
.log-block .wide-input { min-width: 120px; }

/* ── ЧЕКБОКС ── */
.checkbox-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.82rem; color: var(--ink3);
  cursor: pointer;
}
.checkbox-label input[type=checkbox] {
  width: 16px; height: 16px;
  accent-color: var(--green);
  cursor: pointer;
}

/* ── ДОКУМЕНТЫ ── */
.doc-item { margin-bottom: 0.6rem; }
.doc-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.doc-type-sel {
  flex: 2; min-width: 220px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 9px 10px;
  font-family: 'Inter', sans-serif;
  font-size: 0.84rem;
  color: var(--ink);
  background: #fff;
  outline: none;
  cursor: pointer;
  appearance: auto;
}
.doc-type-sel:focus { border-color: var(--green2); box-shadow: 0 0 0 3px rgba(45,122,87,0.1); }
.doc-custom-inp {
  flex: 1.5; min-width: 160px;
}
.doc-row .pfx-wrap.inp-main { flex: 1.2; min-width: 140px; }
.seg.seg-sm button {
  padding: 7px 8px;
  font-size: 0.78rem;
}
.doc-remove {
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  width: 30px; height: 36px;
  font-size: 1rem; color: var(--ink3);
  cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.15s, border-color 0.15s;
}
.doc-remove:hover { color: var(--red); border-color: var(--red); }
.add-doc-btn {
  width: 100%;
  padding: 0.6rem;
  background: none;
  border: 1.5px dashed var(--line);
  border-radius: var(--r);
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem; font-weight: 500;
  color: var(--ink3); cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.add-doc-btn:hover { border-color: var(--green2); color: var(--green2); background: var(--green3); }

/* ── ШИРОКИЕ ЛОГИСТИКА ИНПУТЫ ── */
#cnRate, #cnSum, #cnContainerRate,
#rfRate, #rfSum, #totalLogSum {
  min-width: 140px;
}

/* ── TNVED SEARCH ── */
.tnved-search-wrap { position: relative; }
.tnved-search-input { width: 100%; font-size: 0.88rem; }
.tnved-dropdown {
  position: absolute; top: calc(100% + 2px); left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  max-height: 280px; overflow-y: auto;
  z-index: 200;
}
.tnved-option {
  display: flex; align-items: baseline; gap: 10px;
  padding: 8px 12px; cursor: pointer;
  border-bottom: 1px solid var(--paper2);
  transition: background 0.1s;
}
.tnved-option:last-child { border-bottom: none; }
.tnved-option:hover { background: var(--green3); }
.to-code { font-family: 'Courier New', monospace; font-size: 0.78rem; color: var(--green); font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.to-name { font-size: 0.82rem; color: var(--ink); flex: 1; line-height: 1.3; }
.to-duty { font-size: 0.78rem; font-weight: 600; color: var(--amber); white-space: nowrap; flex-shrink: 0; }
.tnved-found { position: relative; }
.tnved-clear {
  margin-top: 6px; background: none;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 3px 10px; font-family: 'Inter', sans-serif;
  font-size: 0.74rem; color: var(--ink3); cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.tnved-clear:hover { border-color: var(--green2); color: var(--green); }

/* ── МОБИЛЬНЫЕ ── */
@media(max-width: 600px) {
  .tnved-search-input { font-size: 16px; }
  .grid2 { grid-template-columns: 1fr !important; }
  .doc-row { flex-direction: column; align-items: stretch; }
  .doc-type-sel { min-width: 0; width: 100%; }
  .log-block .input-row { flex-direction: column; }
}

/* ── ВЫБОР ВАЛЮТЫ USD/CNY/RUB (3-буквенные коды) ── */
.seg.seg-curr {
  width: 168px;
  flex-shrink: 0;
}
.seg.seg-curr button {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 8px 4px;
}

/* Префикс с кодом валюты — фиксированная ширина, чтобы помещался USD/CNY/RUB */
.pfx-wrap .pfx {
  min-width: 46px;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink2);
}

/* Inputs в logistics — чтобы не наезжали на выбор валюты */
.log-block .input-row,
.log-sub .input-row {
  align-items: stretch;
  flex-wrap: nowrap;
}
.log-block .pfx-wrap.inp-main,
.log-sub .pfx-wrap.inp-main {
  flex: 1 1 auto;
  min-width: 0;
}
.log-block .pfx-wrap.inp-main input,
.log-sub .pfx-wrap.inp-main input {
  min-width: 0;
  width: 100%;
}

/* Старые .seg шириной 130px (внутри input-row) — расширяем до 168px */
.input-row > .seg:not(.seg-curr) { flex-shrink: 0; }

/* Контейнер: переключатель футов */
.log-mode-seg { width: auto; }

/* ── МОБИЛЬНЫЕ — переносим валюту под инпут ── */
@media(max-width: 720px) {
  .input-row { flex-wrap: wrap; }
  .seg.seg-curr { width: 100%; }
  .pfx-wrap.inp-main { flex: 1 1 100%; }
  .doc-row .pfx-wrap.inp-main { flex: 1 1 100%; }
}

/* ── ШРИФТ: ровные цифры везде ── */
body, .result-head, .rh-total, .hero h1, .how-section h2, h1, h2, h3 {
  font-variant-numeric: lining-nums tabular-nums;
  font-feature-settings: "lnum" 1, "tnum" 1;
}
.hero h1, .how-section h2 {
  font-weight: 500;
  letter-spacing: -0.01em;
}
.result-head .rh-total {
  font-family: 'Manrope', system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.how-num {
  font-family: 'Manrope', system-ui, sans-serif;
  font-weight: 600;
}
.logo-text {
  font-family: 'Manrope', system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: 0;
}
