/* =============================================================================
   ЕРЦ-05 — дизайн-система сайта оплаты ЖКУ.
   Мягкая палитра: зелёный (основной), синий (акцент), красный (долги/ошибки).
   Без внешних шрифтов и библиотек — системный стек, всё самодостаточно (CSP).
   ============================================================================= */

:root {
  /* Палитра */
  --green-700: #0d7a50;
  --green-600: #128f5f;
  --green-500: #1aa571;
  --green-100: #d9f2e6;
  --green-50:  #eefaf4;

  --blue-600: #2f6fdb;
  --blue-500: #4a83e6;
  --blue-100: #e3edfc;
  --blue-50:  #f0f6fe;

  --red-600: #d64545;
  --red-500: #e25c5c;
  --red-100: #fbe4e4;
  --red-50:  #fdf1f1;

  --amber-500: #e8a13c;
  --amber-100: #fbf0da;
  --orange-500: #e87d3c;
  --orange-100: #fbe9da;
  --teal-500: #1d9e94;
  --teal-100: #daf1ef;
  --violet-500: #7a63d8;
  --violet-100: #ebe6f9;
  --slate-500: #64748b;
  --slate-100: #eaeef3;

  /* Текст и поверхности */
  --ink: #1c2a35;
  --muted: #62727f;
  --bg: #f3f7f5;
  --card: #ffffff;
  --border: #e2e9e6;
  --border-strong: #cfd9d4;

  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(18, 60, 43, .05), 0 10px 30px -12px rgba(18, 60, 43, .12);
  --shadow-sm: 0 1px 2px rgba(18, 60, 43, .06);

  --font: -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
}

/* ── База ─────────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.35rem, 3vw, 1.7rem); letter-spacing: -.01em; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
a { color: var(--blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { margin: 0; padding: 0; list-style: none; }
b, strong { font-weight: 650; }
svg { display: block; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.container.narrow { max-width: 760px; }
.container.narrow-xs { max-width: 480px; }

.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.accent { color: var(--green-600); }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--card); padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ── Карточки и появление контента ────────────────────────────────────────── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  animation: fade-up .35s ease-out both;
}
/* Лёгкая «лесенка» для соседних карточек */
.card:nth-child(2) { animation-delay: .05s; }
.card:nth-child(3) { animation-delay: .1s; }
.card:nth-child(4) { animation-delay: .15s; }

/* ── Кнопки ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: .95rem;
  cursor: pointer; text-decoration: none !important;
  transition: background .18s ease, border-color .18s ease,
              transform .18s ease, box-shadow .18s ease;
  min-height: 42px;
}
.btn:active { transform: translateY(1px) scale(.99); transition-duration: .06s; }
.btn-primary { background: var(--green-600); color: #fff; }
.btn-primary:hover {
  background: var(--green-700);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -6px rgba(13, 122, 80, .45);
}
.btn-primary:disabled {
  background: var(--border-strong); cursor: not-allowed; transform: none;
}
.btn-outline {
  background: transparent; border-color: var(--border-strong); color: var(--ink);
}
.btn-outline:hover { border-color: var(--green-600); color: var(--green-700); }
.btn-ghost { background: var(--slate-100); color: var(--ink); }
.btn-ghost:hover { background: var(--border); }
.btn-lg { padding: 13px 24px; font-size: 1.02rem; min-height: 50px; }
.btn-sm { padding: 7px 14px; min-height: 36px; font-size: .9rem; }
.btn-block { width: 100%; }

.link-btn {
  background: none; border: none; padding: 0; font: inherit;
  color: var(--blue-600); cursor: pointer; font-weight: 600;
}
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--red-600); }

/* ── Поля ─────────────────────────────────────────────────────────────────── */
.input {
  width: 100%;
  padding: 11px 14px;
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  min-height: 46px;
}
.input:focus {
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px var(--green-100);
}
.input.input-bad { border-color: var(--red-500); }
.input-lg { min-height: 54px; font-size: 1.1rem; }
.input-code {
  text-align: center; letter-spacing: .5em; font-size: 1.4rem;
  font-variant-numeric: tabular-nums;
}
select.input { appearance: auto; }
.field-label {
  display: block; font-size: .875rem; font-weight: 600;
  color: var(--muted); margin: 14px 0 6px;
}

/* ── Шапка (фирменная зелёная) ────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--green-600);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .08);
}
.header-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 64px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none !important; }
.brand-badge {
  width: 48px; height: 48px; border-radius: 50%; background: #fff;
  display: flex; align-items: center; justify-content: center; flex: none;
}
/* Круг рисует .brand-badge, саму картинку не обрезаем: логотип шире, чем
   выше (164:150), и круглая обрезка срезала края букв «Е» и «Ц».
   Ширина 35px — предел, при котором логотип целиком внутри круга ⌀48
   (в круг вписывается квадрат в 1,41 раза меньше диаметра). */
.brand-mark { display: block; width: 35px; height: auto; }
.brand-name { font-size: 1.15rem; font-weight: 800; color: #fff; letter-spacing: -.01em; }
.brand-short { display: none; }
.footer-brand-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.footer-brand-row .footer-brand { margin-bottom: 0; }
/* Как в шапке: круг рисует подложка, картинку не обрезаем — иначе углы
   букв «Е» и «Ц» прижимались к кромке и выглядели срезанными.
   34px в круге ⌀48 — тот же запас, что у шапки (48/35). */
.footer-badge {
  width: 48px; height: 48px; border-radius: 50%; background: #fff;
  display: flex; align-items: center; justify-content: center; flex: none;
}
.footer-badge img { display: block; width: 34px; height: auto; }
.site-nav { display: flex; align-items: center; gap: 4px; }
.nav-link {
  padding: 8px 12px; border-radius: 10px; color: rgba(255, 255, 255, .85);
  font-weight: 600; font-size: .95rem; text-decoration: none !important;
}
.nav-link:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.nav-link.nav-active { color: #fff; font-weight: 800; }
.nav-button { background: none; border: none; font: inherit; cursor: pointer; }
.nav-logout { display: inline-flex; }
.nav-logout .nav-link { color: rgba(255, 255, 255, .6); }
.nav-cta { margin-left: 8px; }
.btn-header {
  background: #fff; color: var(--green-700); padding: 8px 16px;
  min-height: 38px; font-size: .92rem;
}
.btn-header:hover { background: var(--green-50); }
.nav-user {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 5px 12px 5px 5px; margin-left: 6px; border-radius: 999px;
  color: #fff; font-weight: 650; font-size: .93rem;
  text-decoration: none !important; background: rgba(255, 255, 255, .1);
}
.nav-user:hover { background: rgba(255, 255, 255, .2); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: #fff;
  color: var(--green-700); font-size: .8rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center; flex: none;
}
.nav-toggle {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; padding: 10px; cursor: pointer;
}
.nav-toggle span {
  width: 22px; height: 2.5px; border-radius: 2px; background: #fff;
  transition: transform .2s, opacity .2s;
}

/* ── Демо-баннер и флеши ──────────────────────────────────────────────────── */
.demo-banner {
  background: var(--amber-100); color: #7a5717;
  text-align: center; padding: 7px 16px; font-size: .875rem;
}
.flash-stack {
  position: fixed; top: 76px; right: 16px; z-index: 90;
  display: flex; flex-direction: column; gap: 8px; max-width: 360px;
}
.flash {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--card); border: 1px solid var(--border);
  box-shadow: var(--shadow); font-size: .93rem;
  animation: flash-in .25s ease-out;
}
@keyframes flash-in { from { opacity: 0; transform: translateY(-6px); } }
.flash-success { border-left: 4px solid var(--green-500); }
.flash-info    { border-left: 4px solid var(--blue-500); }
.flash-error   { border-left: 4px solid var(--red-500); }
.flash-close {
  margin-left: auto; background: none; border: none; font-size: 1.1rem;
  line-height: 1; cursor: pointer; color: var(--muted); padding: 0 2px;
}

/* ── Главная: hero ────────────────────────────────────────────────────────── */
.hero {
  background:
    radial-gradient(60% 90% at 85% 10%, var(--blue-50) 0%, transparent 60%),
    radial-gradient(50% 80% at 10% 90%, var(--green-50) 0%, transparent 60%),
    linear-gradient(180deg, #fff 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr);
  gap: 40px; align-items: center; padding-top: 56px; padding-bottom: 56px;
}
.hero-sub { font-size: 1.1rem; color: var(--muted); max-width: 46ch; }

.account-form { margin: 22px 0 18px; padding: 18px 20px 14px; }
.account-label {
  display: block; font-size: .875rem; font-weight: 600; color: var(--muted);
  margin-bottom: 6px;
}
.account-row { display: flex; gap: 10px; }
.account-row .input { flex: 1; min-width: 0; }
.account-input { font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.account-hint { font-size: .82rem; color: var(--muted); margin: 10px 0 0; }

.form-tabs { display: flex; gap: 4px; margin-bottom: 14px; flex-wrap: wrap; }
.form-tabs .tab-label { white-space: nowrap; }
.tab-radio { position: absolute; opacity: 0; pointer-events: none; }
.tab-label {
  padding: 7px 14px; border-radius: 999px; font-size: .9rem; font-weight: 600;
  color: var(--muted); cursor: pointer; border: 1px solid transparent;
}
.tab-label:hover { color: var(--ink); }
#tab-els:checked ~ .tab-label[for="tab-els"],
#tab-ls:checked  ~ .tab-label[for="tab-ls"] {
  background: var(--green-50); color: var(--green-700);
  border-color: var(--green-100);
}
.tab-panel { display: none; }
.form-tabs:has(#tab-els:checked) ~ .panel-els { display: block; }
.form-tabs:has(#tab-ls:checked)  ~ .panel-ls  { display: block; }
.panel-ls select { margin-bottom: 12px; }

/* Поиск организации (по названию или ИНН, как в приложении) */
.cpick { position: relative; }
.cpick select { display: none; }
.cpick-list {
  position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px);
  background: var(--card); border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  max-height: 280px; overflow-y: auto;
}
.cpick-item {
  display: block; width: 100%; text-align: left;
  padding: 10px 14px; background: none; border: none;
  border-bottom: 1px solid var(--border);
  font: inherit; cursor: pointer;
}
.cpick-item:last-child { border-bottom: none; }
.cpick-item:hover { background: var(--green-50); }
.cpick-item b { display: block; font-weight: 650; }
.cpick-item span { font-size: .8rem; color: var(--muted); }

.hero-badges { display: flex; flex-direction: column; gap: 8px; }
.badge-item {
  display: flex; align-items: center; gap: 10px;
  font-size: .93rem; color: var(--muted);
}
.badge-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot-green { background: var(--green-500); }
.dot-blue  { background: var(--blue-500); }
.dot-red   { background: var(--red-500); }

/* Иллюстрация-квитанция */
.hero-art { display: flex; justify-content: center; }
.art-card {
  width: min(320px, 100%); background: var(--card);
  border: 1px solid var(--border); border-radius: 20px;
  box-shadow: var(--shadow); padding: 22px; transform: rotate(2deg);
}
.art-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.art-pill { width: 34px; height: 34px; border-radius: 10px; flex: none; }
.p-green { background: var(--green-100); }
.p-blue  { background: var(--blue-100); }
.p-amber { background: var(--amber-100); }
.art-line { height: 10px; border-radius: 5px; background: var(--slate-100); flex: 1; }
.art-line.short { flex: .6; }
.art-total {
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1.5px dashed var(--border-strong);
  padding-top: 14px; margin-top: 4px; font-size: .95rem; color: var(--muted);
}
.art-total b { color: var(--ink); font-size: 1.05rem; }
.art-qr { margin-top: 16px; display: flex; justify-content: center; }
.art-qr svg { width: 92px; height: 92px; fill: var(--ink); }
.art-qr .qr-hole { fill: var(--card); }

/* ── Секции главной ───────────────────────────────────────────────────────── */
.section { padding: 48px 0; }
.section-tint { background: linear-gradient(180deg, var(--bg), var(--green-50)); }
.steps-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 24px;
}
.step-card p { color: var(--muted); font-size: .93rem; margin: 0; }
.step-num {
  width: 38px; height: 38px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.05rem; margin-bottom: 12px;
}
.n-green { background: var(--green-100); color: var(--green-700); }
.n-blue  { background: var(--blue-100);  color: var(--blue-600); }
.n-amber { background: var(--amber-100); color: #9a6a14; }
.n-red   { background: var(--red-100);   color: var(--red-600); }

.cab-promo {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  gap: 32px; align-items: center;
}
.checklist li {
  padding-left: 30px; position: relative; margin-bottom: 10px; color: var(--muted);
}
.checklist li::before {
  content: ""; position: absolute; left: 0; top: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--green-100);
}
.checklist li::after {
  content: ""; position: absolute; left: 5px; top: 8px;
  width: 8px; height: 5px;
  border-left: 2px solid var(--green-700); border-bottom: 2px solid var(--green-700);
  transform: rotate(-45deg);
}
.promo-actions { margin-top: 20px; }
.promo-help { text-align: center; }
.promo-help h3 { margin-bottom: 6px; }
.promo-help .btn { margin: 8px 0; }
.promo-help-art { margin: 0 auto 12px; display: block; }
.hero-skyline {
  display: block; width: 100%; max-width: 520px; height: auto;
  margin-top: 30px;
}
.empty-art { display: block; margin: 0 auto 14px; }

/* ── Страница оплаты ──────────────────────────────────────────────────────── */
.pay-section { padding-top: 28px; }
.crumbs {
  display: flex; gap: 8px; font-size: .875rem; color: var(--muted);
  margin-bottom: 16px;
}
.page-title { font-size: 1.3rem; margin: 26px 0 14px; }
.small-title { margin: 0; }

.account-card { margin-bottom: 6px; }
.account-card-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  flex-wrap: wrap;
}
.account-number {
  font-size: 1.35rem; font-weight: 800; letter-spacing: .03em;
  font-variant-numeric: tabular-nums;
}
.account-address {
  display: flex; align-items: center; gap: 8px;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border);
  color: var(--muted); font-size: .95rem;
}
.account-address .pin {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: var(--green-600); stroke-width: 1.8;
}

.debt-chip {
  padding: 7px 14px; border-radius: 999px; font-weight: 700; font-size: .95rem;
  white-space: nowrap;
}
.chip-red   { background: var(--red-100);   color: var(--red-600); }
.chip-green { background: var(--green-100); color: var(--green-700); }

/* Список услуг */
.services-card { padding: 6px 0 0; overflow: hidden; }
.services-head { padding: 12px 20px; border-bottom: 1px solid var(--border); }
.check-all { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.service-row {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
}
.service-row:last-child { border-bottom: none; }
.service-row.off { background: var(--bg); }
/* Невыбранная строка лишь слегка приглушена — видно, что её МОЖНО выбрать */
.service-row.off .service-text, .service-row.off .svc-icon { opacity: .75; }
.service-main {
  display: flex; align-items: center; gap: 12px; cursor: pointer; min-width: 0; flex: 1;
}
.service-text { min-width: 0; }
.service-name { display: block; font-weight: 650; }
.service-provider {
  display: flex; gap: 5px; font-size: .82rem; color: var(--muted);
  min-width: 0;
}
/* Организация может обрезаться многоточием, номер ЛС — виден ВСЕГДА */
.service-provider .prov {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-width: 0;
}
.service-provider .ls { flex: none; white-space: nowrap; }
.service-amount { text-align: right; flex: none; }
.service-due { font-size: .8rem; margin-bottom: 4px; }
/* Копеечный долг: объясняем, почему услуга не отмечена. Внутри .service-due,
   поэтому сбрасываем цвет и насыщенность родителя (.due-red и т.п.). */
.due-note {
  display: block; font-size: .72rem; line-height: 1.25;
  color: var(--muted); font-weight: 400;
}
.due-red { color: var(--red-600); font-weight: 600; }
.due-green { color: var(--green-700); font-weight: 600; }
.amount-box { position: relative; width: 128px; }
.amount-box .input {
  text-align: right; padding-right: 30px; min-height: 42px;
  font-variant-numeric: tabular-nums; font-weight: 650;
}
.amount-cur {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-weight: 600; pointer-events: none;
}

input[type="checkbox"].svc-check, .check-all input[type="checkbox"] {
  appearance: none; width: 26px; height: 26px; flex: none;
  border: 2px solid var(--border-strong); border-radius: 8px;
  background: var(--card); cursor: pointer;
  transition: background .12s, border-color .12s;
}
input[type="checkbox"].svc-check:hover, .check-all input[type="checkbox"]:hover {
  border-color: var(--green-600);
}
/* Галочка — встроенная картинка: видна одинаково во всех браузерах */
input[type="checkbox"].svc-check:checked, .check-all input[type="checkbox"]:checked {
  background: var(--green-600)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='4' stroke-linecap='round' stroke-linejoin='round' d='M4.5 12.5l5 5L19.5 7'/%3E%3C/svg%3E")
    center / 17px 17px no-repeat;
  border-color: var(--green-600);
}

/* Иконки услуг */
.svc-icon {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: flex; align-items: center; justify-content: center;
}
.svc-icon svg {
  width: 22px; height: 22px; fill: none;
  stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.svc-icon .ico-inner { fill: currentColor; stroke: none; }
.svc-electricity { background: var(--amber-100);  color: #a06e10; }
.svc-gas         { background: var(--orange-100); color: var(--orange-500); }
.svc-cold_water  { background: var(--blue-100);   color: var(--blue-600); }
.svc-hot_water   { background: var(--red-100);    color: var(--red-500); }
.svc-sewage      { background: var(--teal-100);   color: var(--teal-500); }
.svc-heating     { background: var(--red-100);    color: var(--red-500); }
.svc-tko         { background: var(--green-100);  color: var(--green-700); }
.svc-kapremont   { background: var(--violet-100); color: var(--violet-500); }
.svc-uk, .svc-intercom, .svc-antenna, .svc-other
                 { background: var(--slate-100);  color: var(--slate-500); }

/* Подвал оплаты */
.pay-summary { margin-top: 16px; }
.sum-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 6px 0; gap: 12px;
}
.sum-row b { font-variant-numeric: tabular-nums; }
.sum-total {
  border-top: 1.5px dashed var(--border-strong);
  margin-top: 6px; padding-top: 12px; font-size: 1.15rem;
}
.sum-total b { font-size: 1.3rem; font-weight: 800; }
.sum-fee.pending b { opacity: .45; }
.hint-btn {
  width: 18px; height: 18px; border-radius: 50%; border: none;
  background: var(--slate-100); color: var(--muted); font-size: .75rem;
  font-weight: 700; cursor: pointer; vertical-align: 1px;
}
.fee-hint {
  font-size: .85rem; color: var(--muted); background: var(--blue-50);
  border-radius: 10px; padding: 10px 12px; margin: 4px 0 8px;
}
.pay-error {
  background: var(--red-50); border: 1px solid var(--red-100);
  color: var(--red-600); border-radius: 10px; padding: 10px 12px;
  font-size: .9rem; margin: 8px 0;
}
#pay-btn { margin-top: 12px; }
.secure-note {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  font-size: .82rem; color: var(--muted); margin: 12px 0 0;
}
.secure-note svg {
  width: 17px; height: 17px; flex: none;
  fill: none; stroke: var(--green-600); stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.services-empty { padding: 16px 20px; }

/* ── Checkout (QR) ────────────────────────────────────────────────────────── */
.checkout-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap; margin-bottom: 18px;
}
.status-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 999px; font-weight: 650; font-size: .9rem;
}
.chip-wait { background: var(--amber-100); color: #8a5f10; }
.chip-ok   { background: var(--green-100); color: var(--green-700); }
.chip-fail { background: var(--red-100);   color: var(--red-600); }
.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.checkout-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 28px;
}
.qr-block { text-align: center; }
.qr-img, .qr-placeholder {
  width: min(240px, 80%); aspect-ratio: 1; margin: 0 auto 14px;
  border: 1px solid var(--border); border-radius: 16px; background: #fff;
}
.qr-img { object-fit: contain; padding: 8px; }
.qr-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; color: var(--muted); font-size: .85rem; padding: 16px;
}
.qr-placeholder svg { width: 100px; height: 100px; fill: var(--border-strong); }
.qr-placeholder .qr-hole { fill: #fff; }
.sbp-btn { margin-bottom: 10px; }
.items-details summary {
  cursor: pointer; font-weight: 650; padding: 8px 0; list-style: none;
}
.items-details summary::-webkit-details-marker { display: none; }
.mini-items li {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 5px 0; font-size: .92rem; color: var(--muted);
}
.mini-items b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ── Результат ────────────────────────────────────────────────────────────── */
.result-card { text-align: center; padding: 34px 24px; }
.result-icon { display: flex; justify-content: center; margin-bottom: 14px; }
.result-icon svg {
  width: 64px; height: 64px; fill: none; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}
.result-icon.ok svg   { stroke: var(--green-600); }
.result-icon.warn svg { stroke: var(--amber-500); }
.result-icon.fail svg { stroke: var(--red-500); }
.result-icon .dot { fill: currentColor; stroke: none; }
.ico-check { stroke-width: 2.2; }
.receipt {
  max-width: 380px; margin: 20px auto; text-align: left;
  background: var(--bg); border-radius: var(--radius-sm); padding: 14px 18px;
}
.result-actions {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
}

/* ── Вход ─────────────────────────────────────────────────────────────────── */
.auth-section { padding-top: 40px; }
.auth-card { padding: 28px 26px; }
.auth-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.auth-badge {
  background: #fff; border: 1px solid var(--border);
  width: 46px; height: 46px;
}
.auth-title { margin: 0; font-size: 1.35rem; }
.auth-form { margin-top: 6px; }
.auth-form .btn-block { margin-top: 18px; }
.consent-note {
  font-size: .8rem; color: var(--muted); text-align: center; margin: 12px 0 0;
}
.code-cells { display: flex; gap: 10px; justify-content: center; margin: 6px 0 2px; }
.code-cell {
  width: 50px; height: 58px; text-align: center;
  font: inherit; font-size: 1.5rem; font-weight: 800;
  color: var(--ink); background: var(--card);
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm);
  outline: none; transition: border-color .12s, box-shadow .12s;
  font-variant-numeric: tabular-nums;
}
.code-cell:focus {
  border-color: var(--green-600); box-shadow: 0 0 0 3px var(--green-100);
}
.code-cell.filled { border-color: var(--green-600); }
.resend-wrap { min-height: 22px; }
.auth-art {
  display: block; width: 100%; height: auto; max-width: 440px;
  margin: 26px auto 0; opacity: .95;
}
.channel-set { border: none; padding: 0; margin: 0; }
.channel-set legend { padding: 0; }
.channel-row { display: flex; gap: 8px; }
.channel-opt { flex: 1; }
.channel-opt input { position: absolute; opacity: 0; pointer-events: none; }
.channel-opt span {
  display: block; text-align: center; padding: 9px 6px;
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm);
  font-weight: 600; font-size: .92rem; cursor: pointer;
  transition: border-color .12s, background .12s;
}
.channel-opt input:checked + span {
  border-color: var(--green-600); background: var(--green-50);
  color: var(--green-700);
}
.auth-alt {
  display: flex; justify-content: space-between; gap: 10px; margin-top: 16px;
}
.auth-note { margin-top: 22px; }

/* ── Кабинет ──────────────────────────────────────────────────────────────── */
.cab-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap; margin-bottom: 20px;
}
.cab-head h1 { margin: 0; }
.els-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.els-card { display: flex; flex-direction: column; gap: 14px; }
.els-card-top { display: flex; justify-content: space-between; gap: 12px; }
.els-address { font-weight: 650; margin-top: 2px; }
.els-debt { font-weight: 800; font-size: 1.15rem; white-space: nowrap; }
.debt-pos { color: var(--red-600); }
.debt-zero { color: var(--green-700); }
.els-card-actions { display: flex; gap: 8px; margin-top: auto; }
.guest-badge {
  display: inline-block; margin-top: 6px; padding: 2px 10px;
  background: var(--amber-100); color: #8a5f10;
  border-radius: 999px; font-size: .75rem; font-weight: 650;
}
.empty-card { text-align: center; padding: 36px 24px; }

.provider-card { margin-bottom: 12px; padding: 14px 20px; }
.provider-head {
  display: flex; justify-content: space-between; gap: 10px;
  padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.detail-list li {
  display: flex; align-items: center; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.detail-list li:last-child { border-bottom: none; }
.detail-list .svc-icon { width: 34px; height: 34px; border-radius: 10px; }
.detail-list .svc-icon svg { width: 18px; height: 18px; }
.detail-name { flex: 1; min-width: 0; font-weight: 600; }
.detail-nums { display: flex; flex-direction: column; align-items: flex-end; }
.detail-nums b { font-variant-numeric: tabular-nums; }

.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item { padding: 0; overflow: hidden; }
.history-item summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 20px; cursor: pointer; list-style: none;
}
.history-item summary::-webkit-details-marker { display: none; }
.hist-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hist-sum { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.hist-meta { font-size: .85rem; color: var(--muted); }
.chev {
  width: 20px; height: 20px; flex: none; fill: none;
  stroke: var(--muted); stroke-width: 2; transition: transform .15s;
}
.history-item[open] .chev { transform: rotate(180deg); }
.hist-body { padding: 0 20px 16px; border-top: 1px solid var(--border); }

.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.profile-card h3 { margin-bottom: 12px; }
.linked-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.linked-els { display: flex; flex-direction: column; min-width: 0; }
.link-form { margin-top: 14px; }
.link-alt { margin-top: 14px; }
.link-alt summary {
  cursor: pointer; color: var(--blue-600); font-weight: 600;
  font-size: .92rem; list-style: none;
}
.link-alt summary::-webkit-details-marker { display: none; }
.link-alt select { margin-bottom: 4px; }

/* ── Кабинет: обзор (вкладки счетов + таблица + «К оплате») ───────────────── */
.cab-section { padding-top: 24px; }
.els-tabs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 26px; }
.els-tab {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 18px; border-radius: 14px; min-width: 170px;
  background: var(--card); border: 1.5px solid var(--border-strong);
  text-decoration: none !important; transition: border-color .12s;
}
.els-tab:hover { border-color: var(--green-600); }
.els-tab .els-tab-num { font-weight: 800; color: var(--ink); font-size: .98rem; }
.els-tab .els-tab-sub {
  font-size: .8rem; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px;
}
.els-tab.active { background: var(--green-600); border-color: var(--green-600); }
.els-tab.active .els-tab-num { color: #fff; }
.els-tab.active .els-tab-sub { color: rgba(255, 255, 255, .8); }
.els-tab-add { border-style: dashed; background: transparent; }
.els-tab-add .els-tab-num { color: var(--muted); font-weight: 650; }

.cab-title { margin-bottom: 4px; }
.cab-subtitle { margin-bottom: 22px; }

.overview-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px; align-items: start;
}
.overview-aside { position: sticky; top: 84px; display: grid; gap: 14px; }
.overview-aside .pay-summary { margin-top: 0; }  /* отступ нужен только в столбик */
.aside-title { margin: 0 0 10px; font-size: 1.05rem; }
.aside-card-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
}
.aside-card-head .aside-title { margin-bottom: 4px; }
.aside-card p:last-child { margin-bottom: 0; }

.services-table { padding: 0; overflow: hidden; }
.services-table-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 13px 20px; border-bottom: 1px solid var(--border);
}
.services-table-head .col-label {
  font-size: .78rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
}
.services-table-head .check-all { font-size: .9rem; color: var(--green-700); }

/* «Тихое» поле суммы: выглядит как текст, редактируется по клику */
.amount-quiet .input {
  border-color: transparent; background: transparent;
  min-height: 36px; padding: 4px 26px 4px 8px; font-size: 1.02rem;
}
.amount-quiet .input:hover { border-color: var(--border-strong); }
.amount-quiet .input:focus { border-color: var(--green-600); background: var(--card); }
.amount-quiet .amount-cur { right: 8px; }

.meters-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
#sum-count { color: var(--muted); font-weight: 400; }

@media (max-width: 900px) {
  .overview-grid { grid-template-columns: 1fr; }
  .overview-aside { position: static; }
  .meters-grid { grid-template-columns: 1fr; }
  .els-tab { min-width: 0; flex: 1 1 40%; }
}

/* ── Счётчики, верификация, архив ─────────────────────────────────────────── */
.verify-card { margin-top: 16px; border-left: 4px solid var(--blue-500); }
/* auto-fit: одна форма (пока «код» отключён) занимает одну колонку до 440px,
   при возврате второй формы сетка сама станет двухколоночной. */
.verify-grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 440px));
}
.meter-card { margin-bottom: 12px; }
.meter-card.meter-blocked { border-left: 4px solid var(--red-500); }
.meter-head { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.meter-last { text-align: right; }
.meter-warning {
  border-radius: 10px; padding: 9px 12px; font-size: .875rem; margin: 10px 0 0;
}
.warn-amber { background: var(--amber-100); color: #8a5f10; }
.warn-red   { background: var(--red-100);   color: var(--red-600); }
.meter-form { margin-top: 12px; max-width: 420px; }
.refresh-note { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; }
.spinner-dark { border-color: var(--muted); border-top-color: transparent; }

/* Сверка с поставщиками не удалась: суммы из базы, но честно предупреждаем.
   Янтарный, а не красный: платить можно, данные просто могли устареть. */
.stale-note {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 12px 0 0; padding: 10px 12px;
  background: var(--amber-100); color: #8a5f10;
  border-radius: 10px; font-size: .875rem; line-height: 1.45;
}
.stale-note.hidden { display: none; }
.stale-note b { font-weight: 600; }
.stale-icon {
  flex: 0 0 20px; width: 20px; height: 20px; margin-top: 1px;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round;
}
.stale-icon .stale-mark { stroke-linecap: round; }
.stale-icon .stale-mark-dot { fill: currentColor; stroke: none; }
.stale-hint { display: block; margin-top: 2px; opacity: .85; }

/* Пока идёт сверка с поставщиками: суммы размыты, оплата закрыта —
   чтобы устаревшие цифры не вводили в заблуждение */
.pay-form-wrap { position: relative; }
.pay-form-wrap.is-refreshing #pay-form {
  filter: blur(3px); opacity: .55;
  pointer-events: none; user-select: none;
}
.refresh-overlay {
  position: absolute; inset: 0; z-index: 5;
  display: flex; justify-content: center; align-items: flex-start;
  padding-top: 72px;
}
.refresh-badge {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 999px; box-shadow: var(--shadow);
  padding: 10px 22px 10px 14px; font-weight: 650;
  position: sticky; top: 120px;
}
/* Логотип-индикатор: собирается, пока идёт сверка с поставщиками */
.refresh-logo { display: block; width: 44px; height: auto; flex: none; }

/* Ожидание оплаты по QR: тот же собирающийся логотип рядом с пояснением */
.waiting-note { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.waiting-note p { margin: 0; }
.waiting-logo { display: block; width: 52px; height: auto; flex: none; }

.table-card { padding: 6px 0; overflow: hidden; }
.table-scroll { overflow-x: auto; }
.archive-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.archive-table th, .archive-table td {
  padding: 10px 14px; text-align: right; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.archive-table th {
  color: var(--muted); font-weight: 600; font-size: .8rem;
  text-transform: uppercase; letter-spacing: .03em;
}
.archive-table td { font-variant-numeric: tabular-nums; }
.archive-table tr:last-child td { border-bottom: none; }
.archive-table .cell-label { text-align: left; font-weight: 650; }
.archive-table .cell-paid { color: var(--green-700); }
.archive-table .cell-debt { color: var(--red-600); font-weight: 650; }

@media (max-width: 640px) {
  .verify-grid { grid-template-columns: 1fr; }
}

/* ── Памятка о мошенниках (компактная, внизу главной) ─────────────────────── */
.fraud-section { padding: 8px 0 36px; }
.fraud-card { border-left: 4px solid var(--amber-500); padding: 16px 20px; }
.fraud-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.fraud-head h2 { margin: 0; font-size: 1.05rem; }
.fraud-head svg {
  width: 26px; height: 26px; flex: none;
  fill: none; stroke: var(--green-600); stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.fraud-text { font-size: .92rem; color: var(--muted); margin: 0; }
.fraud-text b { color: var(--ink); }

/* ── Страницы документов ──────────────────────────────────────────────────── */
.doc-page { max-width: 760px; }
.doc-page h1 { margin-bottom: 20px; }
.doc-page h2 { font-size: 1.1rem; margin: 26px 0 8px; }
.doc-page p, .doc-page li { color: var(--ink); }
.doc-page ul { padding-left: 22px; list-style: disc; margin-bottom: 14px; }
.doc-page li { margin-bottom: 6px; }
.doc-table { width: 100%; border-collapse: collapse; }
.doc-table td {
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.doc-table tr:last-child td { border-bottom: none; }
.doc-table td:first-child { color: var(--muted); width: 38%; }
.doc-table td:last-child { font-weight: 600; }

/* ── Подвал ───────────────────────────────────────────────────────────────── */
.site-footer {
  margin-top: 40px; background: #16241e; color: #c8d6cf;
}
.footer-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px;
  padding: 36px 20px 24px;
}
.footer-brand { font-size: 1.2rem; font-weight: 800; color: #fff; margin-bottom: 8px; }
.footer-title { font-weight: 700; color: #fff; margin-bottom: 8px; }
.footer-note { font-size: .875rem; margin: 4px 0 0; color: #9fb3a9; }
.footer-phone { font-size: 1.25rem; font-weight: 800; color: #fff; }
.footer-phone:hover { color: var(--green-100); }
.footer-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 2px 0 10px; }
.footer-actions .btn { flex: 1 1 0; max-width: 150px; }
.footer-phone-text { color: #fff; font-weight: 700; }
.help-actions {
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
  margin-bottom: 10px;
}
.help-actions .btn { flex: 1 1 0; min-width: 175px; max-width: 220px; }
.btn-max {
  background: var(--blue-600); color: #fff;
}
.btn-max:hover {
  background: #2558b8; transform: translateY(-1px);
  box-shadow: 0 8px 18px -8px rgba(47, 111, 219, .55);
}
.qr-row { display: flex; gap: 18px; justify-content: center; margin-top: 14px; }
.msg-qr { margin: 0; }
.msg-qr img {
  display: block; background: #fff; border: 1px solid var(--border);
  border-radius: 12px; padding: 6px;
}
.msg-qr figcaption {
  text-align: center; font-size: .8rem; color: var(--muted); margin-top: 4px;
}
.wa-qr-note { text-align: center; }
@media (max-width: 640px) {
  /* На телефоне QR не нужен — кнопки открывают чат напрямую */
  .qr-row, .wa-qr-note { display: none; }
}
.footer-bottom {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  border-top: 1px solid rgba(255, 255, 255, .12);
  padding-top: 16px; padding-bottom: 20px; font-size: .85rem; color: #9fb3a9;
}
.footer-bottom a { color: #c8d6cf; }
.footer-docs { display: flex; gap: 16px; flex-wrap: wrap; }

/* ── Адаптивность ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 24px; padding-top: 36px; padding-bottom: 36px; }
  .hero-art { display: none; }
  .steps-grid { grid-template-columns: 1fr 1fr; }
  .cab-promo { grid-template-columns: 1fr; }
  .checkout-grid { grid-template-columns: 1fr; }
  .els-grid, .profile-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 20px; }
}

@media (max-width: 640px) {
  body { font-size: 15px; }
  .section { padding: 32px 0; }
  .steps-grid { grid-template-columns: 1fr; }

  /* Меню-бургер */
  .nav-toggle { display: flex; }
  .site-nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: var(--green-700);
    padding: 10px 16px 16px; box-shadow: var(--shadow);
  }
  .site-nav.open { display: flex; }
  .nav-link { padding: 12px 14px; }
  .nav-cta { margin: 8px 0 0; justify-content: center; display: flex; }
  .nav-user { margin: 6px 0 0; }
  .nav-logout { display: flex; }
  .nav-logout .nav-link { width: 100%; text-align: left; }

  .account-row { flex-direction: column; }
  .account-row .btn { width: 100%; }

  .service-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .service-amount {
    display: flex; align-items: center; justify-content: space-between;
    padding-left: 52px; gap: 10px;
  }
  /* Длинная подпись («переплата 1 479,22 ₽») переносится, а не налезает
     на поле суммы; само поле ширину не отдаёт */
  .service-amount .service-due {
    margin: 0; flex: 1 1 auto; min-width: 0; text-align: left;
  }
  .service-amount .amount-box { flex: 0 0 auto; }
  .flash-stack { left: 16px; right: 16px; max-width: none; }
  .result-actions .btn { flex: 1; }
  .auth-alt { flex-direction: column; align-items: center; }
}

/* ── Анимации ─────────────────────────────────────────────────────────────── */
/* Появление контента страницы */
@keyframes page-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.site-main { animation: page-in .35s ease-out both; }

/* Карточки-ссылки и вкладки приподнимаются под курсором */
.els-tab, .step-card, .els-card, .history-item, .promo-help {
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.els-tab:hover, .step-card:hover, .promo-help:hover, .history-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

/* Строки услуг: мягкая подсветка, галочка «пружинит» */
.service-row { transition: background .15s ease; }
.service-row:hover { background: var(--green-50); }
.service-row.off:hover { background: var(--bg); }
@keyframes check-pop {
  0% { transform: scale(.8); }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
input[type="checkbox"].svc-check:checked,
.check-all input[type="checkbox"]:checked { animation: check-pop .22s ease-out; }

/* Итоговая сумма мигает при пересчёте (класс ставит pay.js) */
@keyframes sum-bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.06); color: var(--green-700); }
  100% { transform: scale(1); }
}
.sum-total b.bump { display: inline-block; animation: sum-bump .35s ease-out; }

/* Ссылки в навигации: подчёркивание выезжает */
.nav-link { position: relative; }
.nav-link::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 4px;
  height: 2px; border-radius: 1px; background: #fff;
  transform: scaleX(0); transform-origin: left;
  transition: transform .2s ease;
}
.nav-link:hover::after, .nav-link.nav-active::after { transform: scaleX(1); }

/* Поля ввода: плавный фокус уже есть; чипы каналов — тоже приподнимаются */
.channel-opt span { transition: border-color .15s ease, background .15s ease,
                    transform .15s ease; }
.channel-opt input:checked + span { transform: translateY(-1px); }

/* Раскрытие подсказки о комиссии */
@keyframes hint-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}
.fee-hint:not([hidden]) { animation: hint-in .2s ease-out; }

/* Дыхание статуса «Ожидаем оплату» на странице QR */
@keyframes chip-breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: .72; }
}
.chip-wait { animation: chip-breathe 2.2s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
