/* Народна позика — видача й каталог (токени, шапка, кнопки, рамка НБУ, футер — у ../css/base.css) */

.wrap { width: min(1120px, 100% - 32px); margin: 0 auto; }
/* .wrap обнуляє верхній відступ рамки НБУ з base.css — без нього «Більше компаній» налазить на рамку */
.caution.wrap { margin-top: 26px; }

/* ---------- шапка ---------- */
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-tag {
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--ochre);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
a.btn-ghost { color: var(--ink); text-decoration: none; white-space: nowrap; }
@media (max-width: 400px) { .topbar-tag { display: none; } }

/* ---------- вступ ---------- */
.intro { margin-top: 14px; }
.intro h1 { font: 800 clamp(28px, 7.6vw, 46px)/1.08 var(--display); }
.intro h1 em { font-style: normal; color: var(--red); }
.intro p { max-width: 52ch; margin: 8px 0 0; color: var(--muted); }

/* ---------- сітка оферів: 2 в ряд на телефоні, 3 на планшеті, 4 на комп'ютері ---------- */
.offers { margin-top: 28px; }
.offers-title { font: 800 clamp(22px, 5.6vw, 30px)/1.15 var(--display); }
.offers-title span { color: var(--red); }
.offers-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; margin-top: 14px; }

/* Висота картки фіксована, тож резерв під ще не намальовану сітку точний: рядів·h + (рядів − 1)·gap,
   рядів = ⌈оферів / колонок⌉. Видача — 20 оферів, каталог — 25; змінилась кількість — онови множники тут.
   Блок РРС/документів (.oc-docs) з 30.10 порожній. Заповнили поля — картки стануть вищими (:has(.oc-docs)),
   тож перерахуй резерв під цю висоту. */
.offer-card-wrap { height: 228px; }
.offer-card-wrap:has(.oc-docs) { height: 314px; }
#offersGrid:not(:has(.offer-card-wrap)) { min-height: calc(10 * 228px + 9 * 12px); }
#catalogGrid:not(:has(.offer-card-wrap)) { min-height: calc(13 * 228px + 12 * 12px); }

/* Картка вертикальна: ранг і ярлик, логотип, умови рядками, кнопка — так вона влазить у пів екрана телефону */
.offer-card {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 26px 44px 66px 42px;
  grid-template-areas: "head" "logo" "stats" "cta";
  row-gap: 8px;
  padding: 10px 7px 12px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.offer-card:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--linen-2); }
.offer-card:has(.oc-docs) { grid-template-rows: 26px 44px 66px 42px 1fr; grid-template-areas: "head" "logo" "stats" "cta" "docs"; }

.oc-head { grid-area: head; display: flex; align-items: center; gap: 6px; min-width: 0; }
.oc-rank {
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  background: var(--red);
  color: #fff;
  font: 800 14px/1 var(--display);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}
.offer-card-wrap:nth-child(n + 4) .oc-rank { background: var(--ink); }
.oc-logo { grid-area: logo; min-width: 0; display: flex; align-items: center; justify-content: center; }
.oc-logo img { display: block; max-width: min(100%, 150px); max-height: 40px; object-fit: contain; }
.oc-logo img[src$="/cly.png"] { transform: scale(0.75); }
.oc-logo-text { font: 800 17px/1.1 var(--display); color: var(--ink); text-align: center; overflow-wrap: anywhere; }
/* На телефоні «Найкращий вибір» влазить у рядок від 375 px, вужче — переноситься на два рядки в межах 26 px */
.oc-badge, .oc-head::after {
  min-width: 0;
  margin-left: auto;
  padding: 3px 6px;
  overflow: hidden;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  text-transform: uppercase;
}
.oc-badge-best { background: var(--red); color: #fff; }
.oc-badge-top { background: var(--ink); color: var(--ochre); }
.oc-badge-new { background: var(--green); color: #fff; }
.oc-badge-promo { background: var(--ochre); color: var(--ink); }
/* офер, у який уже подали заявку (js/multiapply.js) — ярлик змінюється на позначку */
.offer-card-wrap[data-applied="1"] .oc-badge { display: none; }
.offer-card-wrap[data-applied="1"] .oc-head::after {
  content: "✓ Заявку подано";
  background: rgba(63, 122, 74, 0.14);
  color: var(--green);
  text-transform: none;
  letter-spacing: 0;
}

.oc-stats {
  grid-area: stats;
  margin: 0;
  padding: 6px;
  display: grid;
  grid-auto-rows: 18px;
  background: var(--linen);
  border-radius: 10px;
}
/* Шрифт росте з шириною екрана: найдовше значення «від 0,00001%» влазить від 360 px, вужче — з трикрапкою */
.oc-stats div { min-width: 0; display: flex; align-items: baseline; justify-content: space-between; gap: 5px; }
.oc-stats dt { flex: none; font-size: clamp(9.5px, 2.9vw, 11.5px); line-height: 18px; color: var(--muted); }
.oc-stats dd {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: clamp(11px, 3.3vw, 13px);
  font-weight: 800;
  line-height: 18px;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.oc-cta {
  grid-area: cta;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  font-size: clamp(12px, 3.75vw, 14px);
  white-space: nowrap;
  text-decoration: none;
  outline-offset: -5px;
}
.oc-docs { grid-area: docs; align-self: end; margin: 0; font-size: 10.5px; line-height: 1.35; color: var(--muted); }
.oc-docs a { color: inherit; text-decoration-color: var(--line); }
.oc-docs a:hover { color: var(--red); }

.more { display: flex; justify-content: center; margin-top: 24px; }
.more a { display: inline-flex; align-items: center; gap: 8px; padding: 11px 24px; }

/* ---------- умови та кредитори ---------- */
.terms-grid { display: grid; gap: 14px; }
.legal-block {
  padding: 18px 20px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
}
.legal-block h3 { margin-bottom: 6px; font: 800 19px/1.25 var(--display); }
.legal-block p { margin: 8px 0 0; color: var(--muted); }
.legal-block ul { margin: 10px 0 0; padding-left: 20px; color: var(--muted); }
.legal-block li::marker { color: var(--red); }

.lenders-grid { display: grid; gap: 14px; }
.lender-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 3px dashed var(--red);
  border-radius: 12px;
}
.lender-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px 10px;
}
.lender-head h3 { font: 800 19px/1.2 var(--display); }
.lender-head a {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}
.lender-head a:hover { background: var(--ink); color: var(--paper); }
.lender-body { padding: 0 14px 10px; }
.lender-row {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 10px;
  padding: 6px 0;
  border-top: 1px dotted var(--line);
  font-size: 13px;
  line-height: 1.45;
}
.lender-row span { color: var(--muted); }
.lender-row strong { font-weight: 600; overflow-wrap: anywhere; }

/* ---------- Telegram (js/telegram-fab.js) ---------- */
.telegram-fab {
  position: fixed;
  right: 16px;
  bottom: 18px;
  z-index: 40;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 6px 18px rgba(26, 23, 20, 0.3);
  opacity: 0;
  transform: translateY(14px) scale(0.9);
  transition: opacity 0.3s, transform 0.3s, background 0.2s;
}
.telegram-fab.is-visible { opacity: 1; transform: none; }
.telegram-fab:hover { background: var(--red); }
.telegram-fab svg { width: 26px; height: 26px; fill: var(--paper); }
body.kmb-open .telegram-fab { bottom: calc(var(--kmb-h) + 14px); }

/* ---------- плашка «подайте ще у 2 МФО» (js/multiapply.js) ---------- */
body.kmb-open { padding-bottom: var(--kmb-h); }
.kmb {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--paper);
  border-top: 2px solid var(--ink);
  box-shadow: 0 -8px 24px rgba(26, 23, 20, 0.14);
  animation: np-rise 0.3s ease both;
}
.kmb-inner { width: min(620px, 100%); margin: 0 auto; display: grid; gap: 10px; }
.kmb-head { display: flex; align-items: flex-start; gap: 10px; }
.kmb-copy { flex: 1; min-width: 0; }
.kmb-title { margin: 0; display: flex; align-items: center; gap: 10px; font-weight: 800; }
.kmb-dots { display: inline-flex; gap: 7px; }
.kmb-dot { width: 9px; height: 9px; background: var(--line); transform: rotate(45deg); }
.kmb-dot.is-done { background: var(--green); }
.kmb-text { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.kmb-close {
  flex: none;
  width: 32px;
  height: 32px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
}
.kmb-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px 8px 8px;
  border-radius: 12px;
  background: var(--red);
  box-shadow: 0 3px 0 var(--red-d);
  color: #fff;
  text-decoration: none;
}
.kmb-logo { flex: none; width: 64px; height: 36px; display: grid; place-items: center; border-radius: 8px; background: #fff; }
.kmb-logo img { max-width: 56px; max-height: 28px; object-fit: contain; }
.kmb-btn-copy { flex: 1; min-width: 0; display: grid; }
.kmb-btn-name { overflow: hidden; font-weight: 800; white-space: nowrap; text-overflow: ellipsis; }
.kmb-btn-sum { font-size: 12px; opacity: 0.9; }
.kmb-arrow { font-size: 20px; font-weight: 800; }

/* ---------- топ-3 у каталозі (js/top3popup.js) ---------- */
.top3-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(26, 23, 20, 0.62);
}
.top3 {
  position: relative;
  width: 100%;
  max-width: 400px;
  padding: 24px 18px 16px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 18px;
  outline: 1.5px dashed var(--red);
  outline-offset: -8px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
  animation: np-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.top3-close, .push-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
}
.top3-title { margin: 0; padding: 0 26px; text-align: center; font: 800 26px/1.1 var(--display); }
.top3-sub { margin: 4px 0 14px; text-align: center; font-size: 13px; color: var(--muted); }
.top3-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
/* ранг | логотип над сумою | кнопка — рядок влазить і на 320 px */
.top3-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 10px;
  row-gap: 2px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.top3-row .oc-rank { grid-row: 1 / 3; width: 28px; height: 28px; font-size: 14px; }
.top3-row img { width: 84px; height: 26px; object-fit: contain; object-position: left center; }
.top3-sum { grid-column: 2; font-size: 14px; font-weight: 800; white-space: nowrap; }
.top3-go {
  grid-column: 3;
  grid-row: 1 / 3;
  padding: 9px 14px;
  border-radius: 10px;
  background: var(--red);
  box-shadow: 0 3px 0 var(--red-d);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  animation: np-pulse 1.8s ease-in-out infinite;
}
.top3-note { margin: 12px 0 0; text-align: center; font-size: 11.5px; color: var(--muted); }

/* ---------- запит на push (js/pushnotify.js) ---------- */
.push {
  position: fixed;
  top: 12px;
  left: 16px;
  right: 16px;
  z-index: 9000;
  max-width: 360px;
  margin: 0 auto;
  padding: 14px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.25);
  animation: np-drop 0.3s ease both;
}
.push-row { display: flex; align-items: center; gap: 10px; padding-right: 28px; }
.push-row img { flex: none; }
.push-text { margin: 0; font-size: 14px; font-weight: 800; line-height: 1.3; }
.push-actions { display: flex; gap: 8px; margin-top: 12px; }
.push-actions button {
  flex: 1;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.push-accept { background: var(--red); color: #fff; }
.push-later { background: var(--linen-2); color: var(--ink); }
.push-status { margin: 4px 0; text-align: center; font-size: 13px; font-weight: 700; color: var(--muted); }
.push-status.is-ok { color: var(--green); }

@keyframes np-pop { from { opacity: 0; transform: scale(0.88) translateY(16px); } }
@keyframes np-drop { from { opacity: 0; transform: translateY(-12px); } }
@keyframes np-rise { from { transform: translateY(100%); } }
@keyframes np-pulse { 50% { box-shadow: 0 3px 0 var(--red-d), 0 0 0 6px rgba(181, 36, 43, 0.18); } }

/* ---------- ширші екрани ---------- */
@media (min-width: 640px) {
  .terms-grid, .lenders-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .telegram-fab { right: 24px; bottom: 24px; }
}

/* три картки в ряд — з 720 px: вужче рядок «Ставка від 0,00001%» не влазить у третину екрана */
@media (min-width: 720px) {
  .offers-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
  .offer-card-wrap { height: 264px; }
  .offer-card-wrap:has(.oc-docs) { height: 338px; }
  #offersGrid:not(:has(.offer-card-wrap)) { min-height: calc(7 * 264px + 6 * 14px); }
  #catalogGrid:not(:has(.offer-card-wrap)) { min-height: calc(9 * 264px + 8 * 14px); }
  .offer-card { grid-template-rows: 30px 52px 76px 46px; row-gap: 10px; padding: 12px 12px 14px; }
  .offer-card:has(.oc-docs) { grid-template-rows: 30px 52px 76px 46px 1fr; }
  .oc-rank { width: 30px; height: 30px; font-size: 15px; }
  .oc-logo img { max-width: min(100%, 180px); max-height: 48px; }
  .oc-badge, .oc-head::after {
    padding: 5px 8px;
    font-size: 11px;
    line-height: 1.2;
    letter-spacing: 0.03em;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .oc-stats { padding: 8px 10px; grid-auto-rows: 20px; }
  .oc-stats div { gap: 6px; }
  .oc-stats dt { font-size: 12.5px; line-height: 20px; }
  .oc-stats dd { font-size: 15px; line-height: 20px; }
  .oc-cta { height: 46px; padding: 0 8px; font-size: 16px; outline-offset: -7px; }
  .oc-docs { font-size: 11px; }
}

@media (min-width: 960px) {
  .offers-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
  #offersGrid:not(:has(.offer-card-wrap)) { min-height: calc(5 * 264px + 4 * 16px); }
  #catalogGrid:not(:has(.offer-card-wrap)) { min-height: calc(7 * 264px + 6 * 16px); }
}

@media (min-width: 1024px) {
  .lenders-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* документи: privacy.html, terms.html */
.doc { max-width: 760px; margin-top: 18px; padding-bottom: 48px; }
.doc h1 { font: 800 clamp(28px, 7vw, 40px)/1.1 var(--display); }
.doc .doc-date { margin: 6px 0 26px; color: var(--muted); font-size: 13px; }
.doc h2 { margin: 30px 0 10px; font: 800 21px/1.25 var(--display); }
.doc h3 { margin: 20px 0 8px; font-size: 15px; font-weight: 800; }
.doc p, .doc li { color: var(--muted); font-size: 15px; line-height: 1.7; }
.doc p { margin: 0 0 12px; }
.doc ul { margin: 0 0 12px; padding-left: 20px; }
.doc li { margin-bottom: 4px; }
.doc li::marker { color: var(--red); }
.doc a { color: var(--red); }
.doc strong { color: var(--ink); }
.doc .caution { width: auto; margin: 16px 0; }
.doc .caution p { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  .top3, .push, .kmb, .top3-go { animation: none; }
  .offer-card:hover { transform: none; }
}
