/* ===================================================================
   Finratio · Внутренние страницы (шаблоны, словарь, оферта, политика, кабинет)
   Подключается после brand.css. Общие блоки (.wrap, .pill, .sec) — в home.css.
   =================================================================== */

html body { background: var(--paper); }
main.pg { padding-top: var(--header-h); padding-bottom: clamp(48px, 7vw, 96px); }
main.pg [id] { scroll-margin-top: calc(var(--header-h) + 80px); }

/* ---------- Зелёная шапка страницы ---------- */
.pg-hero { padding-block: 20px 0; }
.pg-band {
  position: relative; overflow: hidden; isolation: isolate; border-radius: var(--r-lg); color: #fff;
  padding: clamp(28px, 4.5vw, 52px);
  background:
    radial-gradient(70% 120% at 100% 0%, rgba(200,168,75,.3), rgba(200,168,75,0) 55%),
    radial-gradient(60% 90% at 0% 100%, rgba(74,124,89,.45), rgba(74,124,89,0) 60%),
    var(--forest);
}
.pg-band::before {
  content: ''; position: absolute; inset: 0; z-index: -1; opacity: .5;
  background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 44px 44px;
}
.pg-band .crumbs { font-size: .88rem; color: rgba(255,255,255,.6); margin-bottom: 14px; }
.pg-band .crumbs a { color: rgba(255,255,255,.8); text-decoration: none; }
.pg-band .crumbs a:hover { color: var(--gold-lt); }
.pg-band h1 { margin: 0; font-size: clamp(2.2rem, 4.4vw, 3.8rem); font-weight: 750; letter-spacing: -0.045em; line-height: 1.02; color: #fff; max-width: 18ch; }
.pg-band h1 em { font-style: normal; color: var(--gold); }
.pg-band .lead { margin: 16px 0 0; max-width: 58ch; font-size: 1.06rem; line-height: 1.55; color: rgba(255,255,255,.8); }
.pg-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.pg-stats .pill { background: rgba(255,255,255,.1); color: #fff; font-weight: 500; }
.pg-stats .pill b { color: var(--gold-lt); font-weight: 700; }
.pg-art { position: absolute; right: clamp(-30px, -1vw, 10px); bottom: -14px; width: min(340px, 32%); z-index: -1; pointer-events: none; }
@media (max-width: 900px) { .pg-art { display: none; } }

.pg-tools { margin-top: 26px; display: grid; gap: 14px; max-width: 760px; }
.pg-search { position: relative; display: block; }
.pg-search input {
  width: 100%; height: 56px; border-radius: 16px; border: 0; padding: 0 20px 0 52px; box-sizing: border-box;
  font: 500 1.02rem var(--font-ui); color: var(--ink); background: #fff; box-shadow: 0 10px 30px -14px rgba(0,0,0,.5);
}
.pg-search input:focus { outline: 3px solid var(--gold); outline-offset: 0; }
.pg-search .ic { position: absolute; left: 18px; top: 50%; translate: 0 -50%; color: var(--ink-3); width: 22px; height: 22px; }
.pg-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pg-chips :is(a, button) {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: 999px; cursor: pointer;
  font: 500 .9rem var(--font-ui); color: #fff; text-decoration: none; text-transform: none; letter-spacing: 0;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16);
  transition: background-color 180ms var(--ease-out), border-color 180ms var(--ease-out), transform 180ms var(--ease-out), color 180ms var(--ease-out);
}
.pg-chips :is(a, button):hover { background: rgba(255,255,255,.16); transform: translateY(-1px); }
.pg-chips :is(a, button).active { background: var(--gold); border-color: var(--gold); color: var(--ink); font-weight: 600; }
.pg-chips small { color: var(--gold-lt); font-weight: 600; }
.pg-chips .active small { color: var(--ink); }

/* липкая полоса разделов под шапкой */
.pg-sticky {
  position: sticky; top: calc(var(--header-h) + 8px); z-index: 50; margin-top: 16px;
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 6px;
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-radius: 18px; box-shadow: 0 8px 24px -18px rgba(12,12,16,.5);
}
.pg-sticky::-webkit-scrollbar { display: none; }
.pg-sticky a {
  flex: none; padding: 9px 14px; border-radius: 12px; white-space: nowrap; text-decoration: none;
  font: 500 .92rem var(--font-ui); color: var(--ink-2); text-transform: none; letter-spacing: 0;
  transition: background-color 180ms var(--ease-out), color 180ms var(--ease-out);
}
.pg-sticky a:hover { background: var(--paper); color: var(--ink); }
.pg-sticky a.on { background: var(--forest); color: #fff; }
.pg-sticky a small { margin-left: 4px; font-size: .78rem; font-weight: 600; color: var(--gold-ink); }
.pg-sticky a.on small { color: var(--gold-lt); }

/* ---------- Документ (оферта, политика) ---------- */
.doc-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; margin-top: 16px; align-items: start; }
.doc-toc {
  position: sticky; top: calc(var(--header-h) + 16px); max-height: calc(100vh - var(--header-h) - 32px); overflow-y: auto;
  background: var(--card); border-radius: 22px; padding: 16px 10px;
}
.doc-toc b { display: block; padding: 4px 10px 8px; font-size: .82rem; font-weight: 600; color: var(--ink-3); }
.doc-toc a {
  display: block; padding: 8px 10px; border-radius: 10px; text-decoration: none; font-size: .9rem; line-height: 1.35; color: var(--ink-2);
  transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out);
}
.doc-toc a:hover { background: var(--paper); color: var(--ink); }
.doc-toc a.on { background: var(--mint); color: var(--forest); font-weight: 600; }
.doc-card { background: var(--card); border-radius: 28px; padding: clamp(24px, 4.5vw, 56px); min-width: 0; }
html body .doc-card :is(h2) { margin: 36px 0 12px; font-size: 1.45rem; font-weight: 700; letter-spacing: -0.025em; line-height: 1.2; color: var(--ink); display: block !important; }
html body .doc-card > :first-child { margin-top: 0; }
html body .doc-card h3 { margin: 26px 0 10px; font-size: 1.12rem; font-weight: 650; color: var(--ink); }
html body .doc-card :is(p, li) { font-size: 1rem; line-height: 1.7; color: var(--ink-2); }
html body .doc-card a { color: var(--forest); text-decoration-color: var(--gold); text-underline-offset: 3px; }
html body .doc-card table { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; margin: 18px 0; font-size: .95rem; }
html body .doc-card th { background: var(--mint); color: var(--forest); font-weight: 650; text-align: left; padding: 12px 14px; text-transform: none; letter-spacing: 0; }
html body .doc-card td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: top; }
html body .doc-card [style*="border-left"] { border-left: 0 !important; border-radius: 16px !important; }
@media (max-width: 900px) {
  .doc-grid { grid-template-columns: 1fr; }
  .doc-toc { position: static; max-height: none; display: flex; overflow-x: auto; gap: 4px; padding: 8px; scrollbar-width: none; }
  .doc-toc b { display: none; }
  .doc-toc a { flex: none; white-space: nowrap; }
}

/* ---------- Словарь ---------- */
.gl-count { margin: 22px 4px 12px; font-size: .92rem; color: var(--ink-3); }
html body .gloss-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
html body .gloss-item {
  background: var(--card); border: 0; border-radius: 20px; padding: 20px 22px; margin: 0;
  transition: transform 220ms var(--ease-out), box-shadow 220ms var(--ease-out);
  animation: glIn 420ms var(--ease-out) both;
}
html body .gloss-item:hover { transform: translateY(-2px); box-shadow: 0 18px 36px -24px rgba(25,57,42,.45); }
@keyframes glIn { from { opacity: 0; transform: translateY(8px); } }
html body .gloss-term { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 1.15rem; font-weight: 700; letter-spacing: -0.015em; color: var(--ink); margin: 0 0 8px; }
html body .gloss-term-eng { margin: 0; padding: 3px 9px; border-radius: 999px; background: var(--mint); color: var(--forest); font: 600 .78rem var(--font-ui); text-transform: none; letter-spacing: 0; }
html body .gloss-def { font-size: .96rem; line-height: 1.6; color: var(--ink-2); }
html body .gloss-letters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
html body .gloss-letter {
  min-width: 34px; height: 34px; padding: 0 8px; border-radius: 10px; display: inline-grid; place-items: center; cursor: pointer;
  font: 600 .88rem var(--font-ui); color: #fff; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); text-decoration: none;
  transition: background-color 160ms var(--ease-out), transform 160ms var(--ease-out);
}
html body .gloss-letter:hover { background: rgba(255,255,255,.18); transform: translateY(-1px); }
html body .gloss-letter.active { background: var(--gold); border-color: var(--gold); color: var(--ink); }
@media (max-width: 760px) { html body .gloss-list { grid-template-columns: 1fr; } }

/* ---------- Шаблоны ---------- */
html body .tpl-section-head { margin: 48px 0 18px !important; padding: 0 !important; border: 0 !important; display: flex !important; align-items: center; gap: 14px; }
html body .tpl-section-head::before {
  content: ''; width: 48px; height: 48px; border-radius: 15px; flex: none;
  background: var(--forest) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e8d080' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='3'/%3E%3Cpath d='M3 9h18M3 15h18M9 3v18'/%3E%3C/svg%3E") center / 24px no-repeat;
}
html body .tpl-section-label { font: 600 .86rem var(--font-ui) !important; color: var(--ink-3) !important; text-transform: none !important; letter-spacing: 0 !important; margin: 0 0 2px !important; }
html body .tpl-section-title { font-size: clamp(1.5rem, 2.4vw, 2rem) !important; font-weight: 750 !important; letter-spacing: -0.03em !important; color: var(--ink) !important; }
html body .page-section { padding: 0 !important; max-width: none !important; }
html body .templates-grid { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)) !important; gap: 14px !important; }
html body .tpl-card {
  border: 0 !important; border-radius: 22px !important; background: var(--card) !important; padding: 22px !important;
  transition: transform 220ms var(--ease-out), box-shadow 220ms var(--ease-out) !important;
}
html body .tpl-card:hover { transform: translateY(-3px); box-shadow: 0 20px 40px -26px rgba(25,57,42,.5) !important; }
html body .tpl-card .tpl-icon { width: 46px !important; height: 46px !important; border-radius: 14px !important; background: var(--mint) !important; color: var(--forest) !important; transition: transform 300ms var(--ease-out); }
html body .tpl-card:hover .tpl-icon { transform: rotate(-6deg) scale(1.05); }
html body .tpl-card:nth-child(3n+2) .tpl-icon { background: var(--gold-light) !important; color: var(--gold-ink) !important; }
html body .tpl-card:nth-child(3n) .tpl-icon { background: var(--ink) !important; color: var(--gold-lt) !important; }
html body .tpl-name { font-size: 1.08rem !important; font-weight: 700 !important; }
html body .tpl-dl { border-radius: 12px !important; background: var(--forest) !important; }
html body .tpl-dl:hover { background: var(--forest-md) !important; }
html body .tpl-card.tpl-paid { background: #fbf8ef !important; }
html body .tpl-card.tpl-paid .tpl-icon { background: var(--gold) !important; color: var(--ink) !important; }
html body .tpl-card.tpl-paid .tpl-dl { background: transparent !important; color: var(--ink) !important; border: 1px solid rgba(12,12,16,.15) !important; }
html body .tpl-paid-badge { background: var(--gold) !important; color: var(--ink) !important; border-radius: 999px !important; }
html body .tpl-paid-note { background: var(--gold-light) !important; border: 0 !important; border-radius: 16px !important; }
html body .tpl-card[hidden], html body .tpl-block[hidden] { display: none !important; }
html body .tpl-sources { background: var(--forest) !important; color: #fff !important; border-radius: 28px !important; }
html body .tpl-sources :is(h2, li strong) { color: #fff !important; }
html body .tpl-sources :is(p, li) { color: rgba(255,255,255,.8) !important; }
html body .tpl-sources a { color: var(--gold-lt) !important; }
.tpl-empty { display: none; margin-top: 24px; padding: 32px; text-align: center; color: var(--ink-3); background: var(--card); border-radius: 22px; }
.tpl-empty.show { display: block; }

/* ---------- Кабинет ---------- */
.pf-grid { display: grid; gap: 16px; margin-top: 16px; }
html body .profile-wrap { margin-top: var(--header-h); min-height: 0; background: var(--paper); padding: 16px max(16px, calc((100vw - 1240px) / 2)) 64px; }
html body .profile-hero {
  border-radius: var(--r-lg); padding: clamp(28px, 4vw, 44px); isolation: isolate;
  background: radial-gradient(70% 120% at 100% 0%, rgba(200,168,75,.3), rgba(200,168,75,0) 55%), radial-gradient(60% 90% at 0% 100%, rgba(74,124,89,.45), rgba(74,124,89,0) 60%), var(--forest);
}
html body .profile-hero::before { background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px); background-size: 44px 44px; opacity: .5; }
html body .profile-hero::after { display: none; }
html body .profile-avatar { width: 80px; height: 80px; border-radius: 24px; font-size: 1.9rem; box-shadow: 0 10px 30px -12px rgba(0,0,0,.5); }
html body .profile-hero-name { font-size: clamp(1.8rem, 3.2vw, 2.6rem); font-weight: 750; letter-spacing: -0.035em; color: #fff; }
html body .profile-hero-email { color: rgba(255,255,255,.7); }
html body .continue-banner { margin-top: 16px; padding: 18px 24px; border-radius: 22px; background: var(--gold); }
html body .continue-text span { font-family: var(--font-ui); }
html body .btn-continue { border-radius: 12px; background: var(--ink); text-transform: none; letter-spacing: 0; font: 600 .98rem var(--font-ui); padding: 12px 22px; }
html body .purchases { padding: 16px 0 0; }
html body .purchases-title { font: 700 1.3rem var(--font-display); letter-spacing: -0.02em; text-transform: none; color: var(--ink); }
html body .purchase-item { border: 0; border-radius: 20px; padding: 20px; background: var(--forest); color: #fff; transition: transform 220ms var(--ease-out); }
html body .purchase-meta { color: rgba(255,255,255,.65); }
html body .purchase-go { color: var(--gold-lt); font-family: var(--font-ui); font-size: .9rem; }
html body .purchases-note { border: 0 !important; border-radius: 14px; }
html body .profile-body { padding: 16px 0 0; max-width: none; grid-template-columns: 380px minmax(0, 1fr); gap: 16px; }
html body :is(.pcard, .course-progress-card, .stats-card) { border: 0; border-radius: 24px; box-shadow: none; background: var(--card); }
html body .pcard-title { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.02em; border-bottom-color: var(--line); }
html body .profile-wrap .form-label { font: 600 .9rem var(--font-ui); text-transform: none; letter-spacing: 0; color: var(--ink); }
html body .profile-wrap .form-input { border-radius: 12px; background: var(--paper); border: 1.5px solid transparent; height: 48px; }
html body .profile-wrap .form-input:focus { border-color: var(--forest); background: #fff; }
html body .btn-save { border-radius: 12px; background: var(--forest); color: #fff; text-transform: none; letter-spacing: 0; font: 600 1rem var(--font-ui); min-height: 48px; }
html body .btn-logout { border-radius: 12px; text-transform: none; letter-spacing: 0; font: 600 .95rem var(--font-ui); }
html body .confirm-modal { border-radius: 24px; }
html body .course-progress-card { padding: 22px 24px; transition: transform 220ms var(--ease-out), box-shadow 220ms var(--ease-out); }
html body .course-progress-card:hover { transform: translateY(-2px); box-shadow: 0 18px 36px -26px rgba(25,57,42,.5); }
html body .cpcard-label { font: 600 .82rem var(--font-ui); text-transform: none; letter-spacing: 0; color: var(--ink-3); }
html body .cpcard-title { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.015em; }
html body .cpcard-pct { font-weight: 750; color: var(--forest); }
html body .progress-bar { height: 10px; border-radius: 999px; background: var(--paper); overflow: hidden; }
html body .progress-fill { border-radius: 999px; background: linear-gradient(90deg, var(--sage), #7fd39b); transition: width 900ms var(--ease-out); }
html body .mod-badge { border-radius: 8px; font-family: var(--font-ui); }
html body .mod-badge.done { background: var(--forest); color: #fff; }
html body .stats-card { background: var(--ink); color: #fff; }
html body .stats-card-title { color: #fff; text-transform: none; letter-spacing: 0; font: 700 1.2rem var(--font-display); }
html body .stat-item { background: rgba(255,255,255,.06); border-radius: 16px; border: 0; }
html body .stat-num { color: var(--gold-lt); }
html body .stat-lbl { color: rgba(255,255,255,.65); text-transform: none; letter-spacing: 0; font-family: var(--font-ui); }
html body .ach { border-radius: 16px; border: 0; background: rgba(255,255,255,.06); color: #fff; }
html body .ach-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--gold); color: var(--ink); display: grid; place-items: center; font-size: 0; flex: none; }
html body .ach-ico .ic { width: 20px; height: 20px; }
html body .ach.locked .ach-ico { background: rgba(255,255,255,.1); color: rgba(255,255,255,.4); filter: none; }
html body .ach-name small { color: rgba(255,255,255,.6); }
@media (max-width: 900px) { html body .profile-body { grid-template-columns: 1fr; } }

/* кнопки «Скачать» — на одном уровне внизу карточки */
html body .tpl-card { display: flex !important; flex-direction: column !important; }
html body .tpl-card .tpl-desc { margin-bottom: 16px; }
html body .tpl-card .tpl-dl, html body .tpl-desc + .tpl-dl, html body .paid-file-error + .tpl-dl { margin-top: auto !important; align-self: flex-start; }
/* на всякий случай: ссылки в полосе разделов не берут глобальный «бледный» стиль nav a */
html body .pg-sticky a { opacity: 1; width: auto; min-height: 0; }
/* style.css даёт всем section боковые поля — на внутренних страницах поля задаёт .wrap */
main.pg > section { padding-inline: 0; }
html body .cert-info { flex-wrap: wrap; }
html body .cert-meta { flex-basis: 100%; margin: 4px 0 0 54px; font-size: .86rem; color: var(--ink-3); }
html body .cert-meta a { color: var(--forest); }
html body .cert-dl { border-radius: 12px; background: var(--forest); color: #fff; text-transform: none; letter-spacing: 0; font: 600 .92rem var(--font-ui); }
html body .cert-sample { margin-top: 14px; padding: 16px 18px; border-radius: 16px; background: var(--gold-light); display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
html body .cert-sample b { display: block; color: var(--ink); }
html body .cert-sample span { font-size: .9rem; color: var(--ink-2); }
html body .cert-sample .cert-dl:disabled { opacity: .5; cursor: not-allowed; }
