/* Платные семейства завода в каталоге /family-library/ (вставляет site/paid-families.js) — по утверждённому макету.
   Каталог берёт токены из tokens.css (--paper, --surface, --secondary, --field), разделы и страницы — из site.css (--day, --ink-2…). */
:root { --pf-ink: var(--ink, #211f1a); --pf-muted: var(--secondary, var(--ink-2, #595750)); --pf-line: var(--line, #d5d0c5);
  --pf-surface: var(--surface, var(--day-surface, #fefdfa)); --pf-paper: var(--paper, var(--day-2, #f2efe8)); --pf-lamp: var(--lamp, #edc18b);
  --pf-focus: var(--focus, var(--brown, #875018)); }

/* ---------- фильтры каталога ---------- */
#catalog > .filter.paid-filter, .filter.paid-filter { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: stretch; }
.paid-filter .pf-label { display: block; font-size: .86rem; color: var(--pf-muted); margin-bottom: .25rem; }
.paid-filter .pf-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 240px); gap: 12px; align-items: end; }
.paid-filter .pf-top input { font-size: 1.05rem; min-height: 48px; }
.paid-filter fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.paid-filter .pf-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.paid-filter .pf-chips legend { width: 100%; }
.paid-filter .pf-chips label { display: inline-flex; position: relative; }
.paid-filter .pf-chips input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.paid-filter .pf-chips span { display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border: 1px solid var(--pf-line); border-radius: 999px; background: var(--pf-surface); color: var(--pf-ink); font-size: .92rem; cursor: pointer; transition: border-color .15s ease, background-color .15s ease; }
.paid-filter .pf-chips span:hover { border-color: var(--pf-muted); }
.paid-filter .pf-chips input:checked + span { background: var(--pf-ink); border-color: var(--pf-ink); color: var(--pf-surface); }
.paid-filter .pf-chips input:focus-visible + span { outline: 2px solid var(--pf-focus); outline-offset: 2px; }
.paid-filter .pf-more { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: end; }
.paid-filter .pf-more label { display: grid; min-width: 150px; }
.paid-filter .pf-width { display: grid; grid-template-columns: 84px 84px; gap: 6px; }
.paid-filter .pf-width legend { grid-column: 1 / -1; }
.paid-filter .pf-more button { width: auto; min-height: 43px; }
@media (max-width: 620px) {
  .paid-filter .pf-top { grid-template-columns: minmax(0, 1fr); }
  .paid-filter .pf-more label { min-width: calc(50% - 8px); flex: 1 1 calc(50% - 8px); }
}
/* телефон: разделы — одна строка, листается пальцем до краёв экрана; полоса прокрутки скрыта, обрезанный чип у края — подсказка */
@media (max-width: 640px) {
  .paid-filter .pf-chips { --pf-bleed: 16px; flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity;
    scrollbar-width: none; margin-inline: calc(-1 * var(--pf-bleed)); padding: 2px var(--pf-bleed) 6px; scroll-padding-inline: var(--pf-bleed); }
  .paid-filter .pf-chips::-webkit-scrollbar { display: none; }
  .paid-filter .pf-chips label { flex: none; scroll-snap-align: start; }
  .paid-filter .pf-chips span { white-space: nowrap; min-height: 36px; padding: 0 13px; }
}

/* ---------- плитки ---------- */
.paid-item { position: relative; }
.paid-thumb { position: relative; display: block; flex: none; width: 100%; aspect-ratio: 4 / 3; background: transparent; border-bottom: 1px solid var(--pf-line); }
.paid-thumb img { position: absolute; inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); object-fit: contain; }
.paid-new { display: inline-block; margin: 0 0 .25rem; padding: 2px 8px; border-radius: 999px; background: var(--pf-lamp); color: #21211c; font-size: .75rem; font-weight: 700; }
.paid-item .paid-price-tile { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--pf-ink); }
.paid-card .paid-new { align-self: flex-start; }
.paid-mark { margin-top: auto; padding-top: 8px; font-weight: 700; color: var(--pf-ink); }

/* ---------- блок заказа ---------- */
.paid-order { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px 20px; margin: 40px 0 0; padding: 22px 24px; border: 2px dashed var(--pf-line); border-radius: 16px; background: var(--pf-surface); color: var(--pf-ink); }
.paid-order-icon { width: 40px; height: 40px; padding: 8px; border-radius: 50%; background: var(--pf-paper); color: var(--pf-ink); }
.paid-order p { margin: 0 0 4px; color: var(--pf-muted); }
.paid-order .paid-order-title { font-size: 1.2rem; line-height: 1.25; font-weight: 700; color: var(--pf-ink); }
.paid-order .paid-order-note { font-size: .8rem; margin: 0; }
.paid-order-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 22px; border-radius: 999px; background: var(--pf-lamp); color: #21211c; font-weight: 700; text-decoration: none; white-space: nowrap; }
.paid-order-btn:hover { text-decoration: underline; }
.paid-order-btn:focus-visible { outline: 2px solid var(--pf-focus); outline-offset: 3px; }
.paid-order-catalog { margin: 48px 0 24px; }
main:has(p.empty:not([hidden])) .paid-order-catalog { display: none; }
p.empty[hidden] + .paid-order-empty { display: none; }
.paid-order-empty { margin-top: 16px; }
@media (max-width: 700px) {
  .paid-order { grid-template-columns: auto minmax(0, 1fr); }
  .paid-order-btn { grid-column: 1 / -1; width: 100%; }
}

/* ---------- страница семейства ---------- */
.paid-gallery .paid-main { margin: 0; }
.paid-gallery img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: contain; background: var(--day-2, var(--pf-paper)); border: 1px solid var(--pf-line); border-radius: 12px; }
.paid-thumbs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.paid-thumbs figure { margin: 0; }
.paid-thumbs a { display: block; }
.paid-thumbs figcaption { color: var(--ink-3, #6f6b62); margin-top: 4px; }
.paid-card-info h1 { margin-bottom: 6px; }
.paid-kind { margin: 0 0 18px; color: var(--ink-2, #595750); }
.paid-price { margin: 0; font-size: 2.2rem; line-height: 1; font-weight: 600; letter-spacing: -0.02em; }
.paid-license { margin: 6px 0 16px; color: var(--ink-2, #595750); }
.paid-volume { margin: 8px 0 0; padding: 8px 12px; border-radius: 10px; background: var(--pf-paper); color: var(--pf-ink); font-size: .9rem; line-height: 1.4; }
.paid-volume + .paid-license { margin-top: 10px; }
.paid-buy { margin: 0; }
.paid-buy .btn { width: 100%; justify-content: center; min-height: 52px; }
.paid-plugin { margin: 10px 0 0; }
.paid-plugin-open { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 16px; border: 1px solid var(--line-strong, var(--pf-line)); border-radius: 999px; color: inherit; font-weight: 600; text-decoration: none; }
.paid-plugin-open:hover { border-color: var(--pf-ink); }
.paid-plugin-open:focus-visible, .paid-plugin summary:focus-visible { outline: 2px solid var(--pf-focus); outline-offset: 2px; }
.paid-plugin summary { margin-top: 6px; text-align: center; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; list-style: none; }
.paid-plugin summary::-webkit-details-marker { display: none; }
.paid-plugin details > div { margin-top: 8px; padding: 14px 16px; border-radius: 12px; background: var(--day-2, var(--pf-paper)); font-size: .92rem; }
.paid-plugin details > div p { margin: 0 0 6px; }
.paid-plugin details > div p:last-child { margin: 0; }
.paid-passport { margin-top: 24px; }
.paid-scroll { overflow-x: auto; }
.paid-params { max-width: 760px; min-width: 520px; }
.paid-params thead th { color: var(--ink-3, #6f6b62); font-size: .875rem; }
.paid-params td, .paid-params th { padding-right: 16px; }
.paid-related { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .paid-related { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- панель «Проверка семейств» (только в кабинете админа, family_review.py) ---------- */
.review-panel { margin: 0 0 28px; padding: 18px 20px; border: 2px solid var(--pf-lamp); border-radius: 16px; background: #fffaf2; }
.review-panel .review-kicker { margin: 0 0 10px; font-size: .85rem; color: var(--ink-2, #595750); }
.review-panel .review-kicker a { color: inherit; }
.review-panel dl { margin: 0 0 14px; display: grid; gap: 6px; }
.review-panel dl div { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: 12px; }
.review-panel dt { color: var(--ink-3, #6f6b62); }
.review-panel dd { margin: 0; overflow-wrap: anywhere; }
.review-form label { display: block; font-size: .9rem; margin-bottom: 4px; }
.review-form textarea { width: 100%; box-sizing: border-box; font: inherit; padding: 8px 10px; border: 1px solid var(--pf-line); border-radius: 8px; background: #fff; }
.review-buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.review-buttons button { min-height: 46px; padding: 0 22px; border-radius: 999px; font: inherit; font-weight: 700; cursor: pointer; }
.review-yes { background: #2f6b3a; color: #fff; border: 0; }
.review-redo { background: #fff; color: #8a2f1c; border: 2px solid #8a2f1c; }
.review-buttons button:focus-visible { outline: 2px solid var(--pf-focus); outline-offset: 2px; }
.paid-buy button[disabled] { opacity: .6; cursor: not-allowed; }
@media (max-width: 620px) { .review-panel dl div { grid-template-columns: minmax(0, 1fr); gap: 0; } }
.paid-subtitle { margin: 0 0 6px; color: var(--ink-2, #595750); font-size: 1.05rem; }
/* плашка «Бесплатно» — та же форма, что у «Новое», свой цвет */
.paid-free { display: inline-block; align-self: flex-start; margin: 0 0 .25rem; padding: 2px 8px; border-radius: 999px; background: #dfe9d8; color: #24412b; font-size: .75rem; font-weight: 700; }
.fam-card .paid-free { margin-bottom: 4px; }

/* две кнопки на плитке и на странице семейства: «В корзину» и «Купить» */
.paid-actions { display: flex; gap: 8px; margin-top: 10px; width: 100%; }
.paid-actions form { flex: 1; margin: 0; }
.paid-actions button { width: 100%; min-height: 40px; padding: 0 10px; border-radius: 999px; font: inherit; font-size: .9rem; font-weight: 700; cursor: pointer; white-space: nowrap; }
.paid-tocart button { background: transparent; color: var(--pf-ink); border: 1px solid var(--pf-ink); }
.paid-buynow button { background: var(--pf-lamp); color: #21211c; border: 1px solid var(--pf-lamp); }
.paid-actions button:hover { filter: brightness(.96); }
.paid-actions button:focus-visible { outline: 2px solid var(--pf-focus); outline-offset: 2px; }
.paid-actions-page button { min-height: 52px; font-size: 1rem; }
/* плитка раздела: ссылка + кнопки внутри одной карточки */
.fam-card.paid-card { display: flex; flex-direction: column; padding: 12px; background: var(--day-surface, #fefdfa); border: 1px solid var(--line, #d5d0c5); border-radius: 12px; }
.fam-card.paid-card > a { flex: 1; padding: 0; border: 0; background: none; border-radius: 0; }
.paid-actions-card { margin-top: 10px; }
/* плашка после «В корзину» */
.paid-added { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 18px; border-radius: 14px; background: #21211c; color: #f4efe4; box-shadow: 0 8px 24px rgb(0 0 0 / .2); font-size: .95rem; max-width: calc(100vw - 32px); }
.paid-added a { color: var(--pf-lamp); font-weight: 700; }
.paid-added button { border: 0; background: none; color: inherit; font-size: 1.3rem; line-height: 1; cursor: pointer; padding: 2px 6px; }
@media (max-width: 380px) { .paid-actions button { font-size: .82rem; padding: 0 6px; } }
.paid-added span, .paid-added a { white-space: nowrap; }
/* панель проверки: третья кнопка «Нет» и оценка контролёра */
.review-no { background: #fff; color: #8a2f1c; border: 2px solid #8a2f1c; }
.review-redo { color: #7a4a0a; border-color: #c8954a; }
.review-score { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: .82rem; font-weight: 700; }
.review-score-good { background: #dfe9d8; color: #24412b; }
.review-score-mid { background: #f6e7c4; color: #5a4210; }
.review-score-low { background: #f6d6d0; color: #7a2216; }
.review-score-none { background: #ece9e2; color: #6f6b62; }

/* Просмотр картинок в рамке (paid-cart.js), 26.11 */
.pic-box { position: fixed; inset: 0; z-index: 1000; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(20, 20, 18, .72); }
.pic-box.pic-box-open { display: flex; }
.pic-box-lock, .pic-box-lock body { overflow: hidden; }
.pic-box-frame { position: relative; width: min(760px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; align-items: center; background: #fff; border-radius: 16px; padding: 48px 56px 16px; box-shadow: 0 12px 40px rgba(0, 0, 0, .25); box-sizing: border-box; }
.pic-box-frame img { display: block; max-width: 100%; max-height: min(70vh, 620px); object-fit: contain; }
.pic-box-cap { margin: 10px 0 0; font-size: 14px; color: #6b6b6b; text-align: center; }
.pic-box-close { position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: #f1efea; color: #222; font-size: 26px; line-height: 40px; cursor: pointer; }
.pic-box-close:hover, .pic-box-nav:hover { background: #e4e1d9; }
.pic-box-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; border-radius: 50%; background: #f1efea; color: #222; font-size: 26px; line-height: 38px; cursor: pointer; }
.pic-box-prev { left: 8px; } .pic-box-next { right: 8px; }
.pic-box-single .pic-box-nav { display: none; }
@media (max-width: 640px) { .pic-box-frame { padding: 52px 12px 12px; } .pic-box-nav { top: auto; bottom: 8px; transform: none; } .pic-box-prev { left: 12px; } .pic-box-next { right: 12px; } .pic-box-frame img { max-height: calc(100vh - 170px); } }
