@page { size: A4; margin: 15mm 20mm; }
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 11pt; line-height: 1.5; color: #434242;
  background: #fff; max-width: 210mm; margin: 0 auto; padding: 15mm 20mm;
}

/* HEADER */
.header {
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 3px solid #FCB514; padding-bottom: 12px; margin-bottom: 8px;
}
.header img { height: 60px; }
.header-contacts { text-align: right; font-size: 9pt; color: #666; }
.header-contacts a { color: #434242; text-decoration: none; }
.doc-subtitle { text-align: center; font-size: 9pt; color: #999; margin-bottom: 20px; padding-top: 4px; }

/* TITLES */
h1 { text-align: center; font-size: 20pt; color: #434242; margin: 20px 0 6px; font-weight: 700; }
.title-accent {
  display: block; text-align: center; font-size: 12pt;
  color: #FCB514; font-weight: 600; margin-bottom: 24px;
}
.title-accent a {
  color: #FCB514;
  text-decoration: none;
  margin: 0 4px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.2s;
}
.title-accent a:hover {
  background: #FCB514;
  color: #fff;
}
h2 { font-size: 14pt; color: #434242; border-left: 4px solid #FCB514; padding-left: 10px; margin: 28px 0 12px; page-break-after: avoid; }
h3 { font-size: 11pt; color: #FCB514; margin: 16px 0 8px; font-weight: 700; }

/* TABLES */
table { width: 100%; border-collapse: collapse; margin: 10px 0 16px; font-size: 9.5pt; }
th { background: #434242; color: #FEFEFE; font-weight: 600; text-align: left; padding: 6px 8px; font-size: 9pt; }
td { padding: 4px 8px; border-bottom: 1px solid #e0e0e0; vertical-align: top; }
tr:nth-child(even) { background: #faf8f3; }
td:hover { background: #fef5dc; }
tr.search-hit td {
  background: #fff3cd !important;
  animation: pulse-highlight 1.2s ease-in-out 2;
}
tr.search-hit td:first-child {
  border-left: 3px solid #FCB514;
}
@keyframes pulse-highlight {
  0%, 100% { background: #fff3cd; }
  50% { background: #ffe168; }
}

/* BADGES — plain text variant */
.badge {
  display: inline-block;
  font-size: 9pt;
  padding: 0;
  background: none;
  vertical-align: middle;
  color: #434242;
  font-weight: 500;
}
.badge-eaeu { font-weight: 500; }
.badge-nat { font-style: italic; color: #8a6500; }
.badge-both { font-weight: 600; }

/* NOTES */
.note { background: #fef9e7; border-left: 4px solid #FCB514; padding: 10px 14px; margin: 12px 0; font-size: 10pt; }
.note-title { font-weight: 700; color: #434242; }
.warning { background: #fdecea; border-left: 4px solid #d32f2f; }
.info-box { background: #f5f4f1; border-left: 4px solid #434242; padding: 10px 14px; margin: 12px 0; font-size: 10pt; }

/* LINKS */
a { color: #b8860b; }
a:hover { color: #FCB514; }
.source-link {
  display: inline-block; background: #434242; color: #FCB514 !important;
  padding: 4px 12px; border-radius: 4px; text-decoration: none;
  font-size: 9pt; margin: 4px 4px 4px 0;
}
.source-link:hover { background: #333; }
.summary-table th { background: #FCB514; color: #434242; }

/* FOOTER */
.footer {
  margin-top: 40px; padding-top: 12px; border-top: 3px solid #FCB514;
  display: flex; justify-content: space-between;
  font-size: 8pt; color: #999;
}

/* BACK LINK */
.back-link {
  display: inline-block;
  margin: 16px 0;
  color: #434242;
  text-decoration: none;
  font-weight: 600;
  font-size: 10pt;
  padding: 6px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  transition: all 0.2s;
}
.back-link:hover { border-color: #FCB514; background: #faf8f3; color: #FCB514; }
.back-link::before { content: "← "; }

/* SEARCH */
.search-box {
  margin: 24px 0;
}
.search-input-wrap {
  display: flex;
  align-items: stretch;
  gap: 10px;
}
.search-box input {
  flex: 1;
  padding: 14px 18px;
  font-size: 13pt;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-family: inherit;
  color: #434242;
  outline: none;
  transition: border-color 0.2s;
}
.search-box input:focus { border-color: #FCB514; }
.search-box input::placeholder { color: #999; }
.search-clear {
  padding: 14px 24px;
  background: #434242;
  color: #FCB514;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 11pt;
  font-weight: 600;
  font-family: inherit;
}
.search-clear:hover { background: #2a2a2a; }

/* SEARCH RESULTS CARD */
.search-results {
  margin-top: 16px;
}
.search-results:empty { display: none; }
.results-title {
  font-size: 11pt;
  color: #434242;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e0e0e0;
}
.results-title strong { color: #FCB514; }
.results-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
}
.result-country {
  padding: 12px 16px;
  border-bottom: 1px solid #e0e0e0;
  background: #fff;
}
.result-country:nth-child(even) {
  background: #faf8f3;
}
.result-country:last-child { border-bottom: none; }
.result-country.empty { opacity: 0.5; }
.result-country-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.result-country-name {
  font-weight: 700;
  color: #434242;
  font-size: 11pt;
}
.result-country.empty .result-country-name { font-weight: 500; font-style: italic; }
.result-jump {
  color: #FCB514;
  text-decoration: none;
  font-size: 9pt;
  font-weight: 600;
  padding: 4px 12px;
  border: 1px solid #FCB514;
  border-radius: 4px;
  transition: background 0.2s;
}
.result-jump:hover { background: #FCB514; color: #fff; }
.result-row {
  display: flex;
  gap: 10px;
  padding: 3px 0;
  font-size: 9.5pt;
}
.result-code {
  min-width: 110px;
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 9pt;
  color: #6a994e;
  font-weight: 600;
}
.result-desc {
  color: #434242;
  flex: 1;
}
.result-empty-text {
  font-size: 9.5pt;
  color: #999;
  font-style: italic;
}
.result-rule-note {
  margin-top: 8px;
  padding: 6px 10px;
  background: #fef9e7;
  border-left: 3px solid #FCB514;
  font-size: 9pt;
  color: #5a4900;
  border-radius: 4px;
}
.no-results-box {
  padding: 16px;
  background: #fdecea;
  border-radius: 6px;
  color: #d32f2f;
  font-weight: 600;
  text-align: center;
}

/* "ИЗ" MEMO */
.iz-memo {
  margin: 16px 0;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  overflow: hidden;
}
.iz-memo summary {
  list-style: none;
  cursor: pointer;
  padding: 8px 12px;
  background: #faf8f3;
  border-left: 3px solid #FCB514;
  font-size: 10pt;
  font-weight: 600;
  color: #434242;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.2s;
}
.iz-memo summary:hover { background: #fef5dc; }
.iz-memo summary::-webkit-details-marker { display: none; }
.iz-memo summary::after {
  content: "▸";
  font-size: 11pt;
  color: #FCB514;
  transition: transform 0.2s;
}
.iz-memo[open] summary::after { transform: rotate(90deg); }
.iz-memo[open] summary {
  background: #fef5dc;
  border-bottom: 1px solid #e0e0e0;
}
.iz-memo summary .iz-star {
  color: #FCB514;
}
.iz-memo .iz-content {
  padding: 12px;
  font-size: 10pt;
  color: #434242;
}
.iz-star {
  color: #434242;
  font-weight: 900;
  font-size: 13pt;
  margin-right: 4px;
}

/* Highlight "из*" prefix in result codes */
.result-code .iz-prefix {
  color: #FCB514;
  font-weight: 700;
}

/* CATEGORIES (table sections) */
.cat-section {
  margin: 24px 0;
}

/* Collapsible block (comparison) */
details.collapsible {
  margin: 16px 0;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  overflow: hidden;
}
details.collapsible > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 16px;
  background: #faf8f3;
  border-left: 4px solid #FCB514;
  font-size: 13pt;
  font-weight: 700;
  color: #434242;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.2s;
}
details.collapsible > summary:hover { background: #fef5dc; }
details.collapsible > summary::-webkit-details-marker { display: none; }
details.collapsible > summary::after {
  content: "▸";
  font-size: 14pt;
  color: #FCB514;
  transition: transform 0.2s;
}
details.collapsible[open] > summary::after { transform: rotate(90deg); }
details.collapsible[open] > summary {
  background: #fef5dc;
  border-bottom: 1px solid #e0e0e0;
}
details.collapsible > .content { padding: 16px; }

/* Compact variant — smaller header */
details.collapsible.compact > summary {
  padding: 8px 12px;
  font-size: 10pt;
  font-weight: 600;
  border-left-width: 3px;
}
details.collapsible.compact > summary::after {
  font-size: 11pt;
}
details.collapsible.compact > .content {
  padding: 12px;
  font-size: 10pt;
}

/* Accent variant — gold background, prominent */
details.collapsible.accent {
  margin: 18px 0;
  border: 1px solid #FCB514;
  box-shadow: 0 1px 4px rgba(252, 181, 20, 0.15);
}
details.collapsible.accent > summary {
  background: linear-gradient(90deg, #FCB514 0%, #f5b020 100%);
  border-left: none;
  color: #434242;
  font-size: 11pt;
  padding: 10px 14px;
}
details.collapsible.accent > summary:hover {
  background: linear-gradient(90deg, #f5b020 0%, #e8a519 100%);
}
details.collapsible.accent > summary::after {
  color: #434242;
  font-size: 12pt;
}
details.collapsible.accent[open] > summary {
  background: linear-gradient(90deg, #FCB514 0%, #f5b020 100%);
  border-bottom: 1px solid #f5b020;
}
.close-btn {
  display: block;
  margin: 16px auto 4px;
  padding: 8px 20px;
  background: #434242;
  color: #FCB514;
  border: none;
  border-radius: 6px;
  font-size: 10pt;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}
.close-btn:hover { background: #2a2a2a; }
.close-btn::before { content: "▲ "; }

/* ============================================================ */
/* МОБИЛЬНАЯ ВЕРСИЯ                                              */
/* ============================================================ */
@media (max-width: 768px) {
  body {
    padding: 12px;
    font-size: 14px;
  }

  /* Шапка — логотип уменьшен, контакты под ним */
  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding-bottom: 10px;
  }
  .header img { height: 40px; }
  .header-contacts {
    text-align: left;
    font-size: 10px;
    line-height: 1.5;
  }
  .doc-subtitle { font-size: 10px; margin-bottom: 14px; }

  /* Заголовки */
  h1 { font-size: 18pt; margin: 14px 0 4px; }
  .title-accent {
    font-size: 11pt;
    margin-bottom: 18px;
    line-height: 2;
  }
  .title-accent a {
    display: inline-block;
    padding: 4px 10px;
    margin: 2px;
    border: 1px solid #FCB514;
    border-radius: 6px;
  }
  h2 { font-size: 13pt; margin: 18px 0 8px; }

  /* Поиск */
  .search-box input {
    font-size: 16px; /* >=16px — iOS не зумит */
    padding: 12px 14px;
  }
  .search-box .search-input-wrap {
    flex-direction: column;
    gap: 8px;
  }
  .search-clear {
    font-size: 14px;
    padding: 12px 16px;
  }

  /* Карточка результатов поиска */
  .result-country { padding: 10px 12px; }
  .result-country-name { font-size: 14px; }
  .result-jump { font-size: 11px; padding: 4px 10px; }
  .result-row { flex-direction: column; gap: 2px; padding: 4px 0; }
  .result-code { min-width: 0; font-size: 12px; }
  .result-desc { font-size: 13px; }

  /* Таблицы — горизонтальная прокрутка с подсказкой */
  table {
    font-size: 12px;
    display: block;
    overflow-x: auto;
    white-space: normal;
    -webkit-overflow-scrolling: touch;
  }
  table th, table td { padding: 6px 8px; }
  th { font-size: 11px; }

  /* Сравнение — таблица в горизонтальной прокрутке */
  #comparison-block .comp-table { font-size: 11px; min-width: 600px; }
  #comparison-block .comp-table th { font-size: 10px; padding: 6px 4px; }
  #comparison-block .comp-table td { padding: 4px; }
  #comparison-block .comp-table th.country-col { width: 50px; }
  #comparison-block .comp-cat-title { font-size: 11pt; padding: 6px 10px; }

  /* Tooltip — на мобильных не показывать (нет hover) */
  #comparison-block .country-cell[data-tip]::before,
  #comparison-block .country-cell[data-tip]::after { display: none; }

  /* Кнопки */
  .source-link, .back-link {
    display: inline-block;
    padding: 8px 14px;
    font-size: 13px;
  }

  /* Памятка «из» */
  .iz-memo summary { font-size: 13px; padding: 10px 12px; }
  .iz-memo .iz-content { padding: 12px; font-size: 13px; }

  /* Сворачиваемые блоки */
  details.collapsible > summary { font-size: 13px; padding: 12px; }
  details.collapsible.compact > summary { font-size: 12px; padding: 8px 12px; }
  details.collapsible > .content { padding: 14px; }

  /* Памятка-карточка */
  .info-box, .note { padding: 10px 12px; font-size: 12px; }
  .summary-table { font-size: 11px; }
  .summary-table th { font-size: 10px; padding: 6px; }
  .summary-table td { padding: 6px; }

  /* Кнопка-ссылка на сравнение в стране */
  .footer { font-size: 9pt; flex-direction: column; gap: 4px; text-align: center; }
}

/* Очень узкие — телефоны старого формата */
@media (max-width: 380px) {
  body { padding: 8px; }
  h1 { font-size: 16pt; }
  .title-accent a { padding: 3px 8px; font-size: 10pt; }
  table { font-size: 11px; }
}

@media print {
  body { padding: 0; max-width: none; }
  .source-link { background: #eee; color: #434242 !important; border: 1px solid #ccc; }
  td:hover { background: inherit; }
  h2 { page-break-after: avoid; }
  table { page-break-inside: auto; }
  tr { page-break-inside: avoid; }
  .search-box { display: none !important; }
  .back-link { display: none !important; }
  .iz-memo[open] .iz-content { display: block !important; }
  details.collapsible { border: none; }
  details.collapsible > summary { background: none; padding: 0 0 0 10px; font-size: 14pt; }
  details.collapsible > summary::after { display: none; }
  details.collapsible > .content { padding: 0; display: block !important; }
  details.collapsible > *:not(summary) { display: block !important; }
  .close-btn { display: none !important; }
}
