/* ==========================================================================
   Demure VPN — личный кабинет (дополняет style.css)
   ========================================================================== */

/* ---------- вход ---------- */
.cab-login { position: relative; min-height: 100svh; display: grid; place-items: center; padding: calc(var(--header-h) + 32px) var(--gutter) 64px; overflow: hidden; }
.cab-login__card { position: relative; z-index: 2; width: min(440px, 100%); text-align: center; padding: 44px 32px 32px; background: var(--glass); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.cab-login__mark { height: 96px; width: auto; margin: 0 auto; overflow: visible; fill: var(--fg); }
.cab-login h1 { margin-top: 28px; font-size: 30px; }
.cab-login__lead { margin-top: 10px; color: var(--fg-2); font-size: 15px; }
.cab-login__actions { margin-top: 26px; display: flex; flex-direction: column; gap: 10px; align-items: stretch; text-align: left; }
.cab-login__legal { margin-top: 22px; font-size: 12.5px; color: var(--fg-3); }
.cab-login__legal a, .consent a { text-decoration: underline; text-underline-offset: 2px; }
.cab-login__locked { opacity: .35; pointer-events: none; filter: grayscale(1); transition: opacity .25s; }
.cab-login .flames { width: clamp(220px, 30vw, 460px); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--fg-3); font-size: 12px; letter-spacing: .3em; text-transform: uppercase; margin: 6px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border-2); }
.linkish { background: none; border: 0; padding: 0; color: var(--fg-2); font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.linkish:hover { color: var(--fg); }
.form-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.form-note { font-size: 13.5px; color: var(--fg-2); text-align: center; }
.consent { display: flex; gap: 12px; align-items: flex-start; text-align: left; font-size: 13.5px; color: var(--fg-2); cursor: pointer; padding: 12px 14px; border: 1px solid var(--border-2); border-radius: 14px; }
.consent input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--fg); flex: none; }
.waiting { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 8px 0; text-align: center; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border-2); border-top-color: var(--fg); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- макет кабинета ---------- */
.cab { padding: calc(var(--header-h) + 40px) 0 120px; min-height: 100svh; }
.cab-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.cab-user { display: flex; align-items: center; gap: 16px; min-width: 0; }
.cab-user > div { min-width: 0; }
.avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--inv-bg); color: var(--inv-fg); display: grid; place-items: center; font-weight: 800; font-size: 20px; overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.cab-user h1 { font-size: clamp(24px, 3vw, 32px); overflow-wrap: anywhere; }
.cab-user p { color: var(--fg-3); font-size: 14px; margin-top: 2px; overflow-wrap: anywhere; }
.cab-top .header-actions { margin-left: 0; }
.demo-pill { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px dashed var(--fg-3); font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--fg-2); }

.cab-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.span-8 { grid-column: span 8; }
.span-4 { grid-column: span 4; }
.span-7 { grid-column: span 7; }
.span-5 { grid-column: span 5; }
.span-12 { grid-column: span 12; }
.cab-card { position: relative; overflow: hidden; }
.cab-card > :not(.slash) { position: relative; }
.cab-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.cab-card__head h2 { font-size: 18px; letter-spacing: -.01em; }
.cab-card__hint { color: var(--fg-3); font-size: 13px; }

.status { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 700; border: 1px solid var(--border-2); white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--fg-3); }
.status--active { background: var(--inv-bg); color: var(--inv-fg); border-color: var(--inv-bg); }
.status--active::before { background: var(--inv-fg); animation: pulse 2s ease-in-out infinite; }
.status--trial::before { background: var(--fg); }
@keyframes pulse { 50% { opacity: .35; } }

.sub-main { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.sub-days { font-size: clamp(56px, 8vw, 88px); font-weight: 800; letter-spacing: -.05em; line-height: .9; }
.sub-days small { font-size: 18px; font-weight: 700; letter-spacing: 0; margin-left: 8px; color: var(--fg-2); }
.sub-until { color: var(--fg-2); font-size: 15px; margin-top: 10px; }
.progress { margin-top: 26px; height: 6px; border-radius: 999px; background: var(--bg-3); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--fg); border-radius: inherit; transition: width .8s var(--ease); }
.sub-stats { margin-top: 26px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { padding: 16px 18px; border-radius: 14px; background: var(--bg-2); min-width: 0; }
.stat__k { font-size: 12px; color: var(--fg-3); letter-spacing: .14em; text-transform: uppercase; font-weight: 700; }
.stat__v { margin-top: 6px; font-size: 18px; font-weight: 800; letter-spacing: -.01em; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.empty-sub { padding: 8px 0 4px; }
.empty-sub h3 { font-size: clamp(26px, 3.4vw, 36px); }
.empty-sub p { margin-top: 10px; color: var(--fg-2); max-width: 520px; }
.empty-sub .hero__actions { margin-top: 22px; }

.balance { font-size: 48px; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.balance small { font-size: .45em; margin-left: 4px; }
.balance-actions { margin-top: 24px; display: flex; gap: 10px; flex-wrap: wrap; }

.sublink { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 16px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--border); }
.sublink code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 13.5px; color: var(--fg-2); }
/* раскрытая ссылка: текст целиком; на телефоне кнопки уходят под него */
.sublink.is-open code { white-space: normal; overflow-wrap: anywhere; word-break: break-all; line-height: 1.5; color: var(--fg); user-select: all; padding: 6px 0; }
.connect { display: grid; grid-template-columns: minmax(0, 1fr) 176px; gap: 24px; align-items: start; }
.qr { width: 176px; aspect-ratio: 1; border-radius: 16px; background: #fff; padding: 12px; display: grid; place-items: center; color: #77777D; font-size: 13px; text-align: center; }
.qr svg { width: 100%; height: 100%; }
.qr svg path { fill: #0B0B0C; }
.deeplinks { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.connect__hint { margin-top: 18px; font-size: 14px; color: var(--fg-3); }
.connect__hint a { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }
.steps-list { margin: 18px 0 0; padding: 0; list-style: none; counter-reset: st; display: flex; flex-direction: column; gap: 10px; }
.steps-list li { counter-increment: st; display: grid; grid-template-columns: 30px 1fr; gap: 10px; color: var(--fg-2); font-size: 14px; }
.steps-list li::before { content: counter(st, decimal-leading-zero); color: var(--fg); font-weight: 800; font-size: 13px; padding-top: 1px; }

.chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip label {
  display: flex; flex-direction: column; gap: 2px; height: 100%; padding: 14px 16px; border-radius: 14px;
  border: 1px solid var(--border-2); cursor: pointer; transition: border-color .2s, background-color .2s, color .2s;
}
.chip label b { font-size: 15px; }
.chip label span { font-size: 13px; color: var(--fg-3); }
.chip label:hover { border-color: var(--fg-3); }
.chip input:checked + label { background: var(--inv-bg); color: var(--inv-fg); border-color: var(--inv-bg); }
.chip input:checked + label span { color: color-mix(in srgb, var(--inv-fg) 60%, transparent); }
.chip input:focus-visible + label { outline: 2px solid var(--fg); outline-offset: 2px; }
.chip input:disabled + label { opacity: .4; cursor: not-allowed; }
.chips--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.chips--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.chips + .chips { margin-top: 14px; }
.renew-total { margin: 20px 0 16px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--fg-2); }
.renew-total b { font-size: 26px; color: var(--fg); letter-spacing: -.02em; white-space: nowrap; }
.renew-total s { color: var(--fg-3); font-size: 15px; margin-right: 8px; font-weight: 600; }
.renew-hint { margin-top: 10px; font-size: 13px; color: var(--fg-3); text-align: center; }

.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
.list-row__icon { width: 40px; height: 40px; border-radius: 12px; background: var(--bg-2); display: grid; place-items: center; flex: none; }
.list-row__icon svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.list-row__main { flex: 1; min-width: 0; }
.list-row__main b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row__main span { font-size: 13px; color: var(--fg-3); }
.list-row__side { text-align: right; font-size: 14px; font-weight: 700; white-space: nowrap; }
.list-row__side span { display: block; font-size: 12px; color: var(--fg-3); font-weight: 600; }
.empty { padding: 28px 0; text-align: center; color: var(--fg-3); font-size: 14px; }

.field { display: flex; gap: 8px; }
.input {
  flex: 1; min-width: 0; width: 100%; height: 48px; padding: 0 16px; border-radius: 14px;
  border: 1px solid var(--border-2); background: var(--bg-2); outline: none; font-weight: 600;
  transition: border-color .2s;
}
.input:focus { border-color: var(--fg); }
.input::placeholder { color: var(--fg-3); font-weight: 500; }
.input-label { display: block; font-size: 13px; color: var(--fg-2); font-weight: 600; margin: 0 0 6px 2px; }
.stack { display: flex; flex-direction: column; gap: 12px; }

.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--bg-3); border: 1px solid var(--border-2); transition: background-color .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--fg-3); transition: transform .25s var(--ease), background-color .2s; }
.switch input:checked + span { background: var(--inv-bg); border-color: var(--inv-bg); }
.switch input:checked + span::after { transform: translateX(18px); background: var(--inv-fg); }
.switch input:focus-visible + span { outline: 2px solid var(--fg); outline-offset: 2px; }
.switch input:disabled { cursor: not-allowed; }

.ref-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }

.notice { text-align: center; }
.notice h2 { font-size: 24px; }
.notice p { margin-top: 10px; color: var(--fg-2); }
.notice .hero__actions { justify-content: center; }

.cab-foot { margin-top: 40px; display: flex; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; font-size: 13px; color: var(--fg-3); }
.cab-foot nav { display: flex; gap: 18px; flex-wrap: wrap; }
.cab-foot a:hover { color: var(--fg); }

/* ---------- модалки и тосты ---------- */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .6); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: fade .2s ease; }
.modal__dialog { position: relative; width: min(480px, 100%); max-height: calc(100svh - 32px); overflow: auto; background: var(--bg-1); border: 1px solid var(--border-2); border-radius: 24px; padding: 28px; animation: pop .3s var(--ease); }
.modal__dialog h2 { font-size: 24px; padding-right: 40px; }
.modal__dialog > p { margin-top: 8px; color: var(--fg-2); font-size: 15px; }
.modal__close { position: absolute; top: 18px; right: 18px; }
.modal__section { margin-top: 22px; }
.modal__section > .label { margin-bottom: 12px; display: block; letter-spacing: .3em; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); }
.toast { pointer-events: auto; max-width: 440px; background: var(--inv-bg); color: var(--inv-fg); padding: 13px 20px; border-radius: 999px; font-size: 14px; font-weight: 700; box-shadow: var(--shadow); animation: pop .3s var(--ease); text-align: center; }
.toast.is-out { opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s; }

.skeleton { background: linear-gradient(90deg, var(--bg-2), var(--bg-3), var(--bg-2)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- адаптив ---------- */
@media (max-width: 1080px) {
  .span-8, .span-4, .span-7, .span-5 { grid-column: span 12; }
}
@media (max-width: 900px) {
  .connect { grid-template-columns: minmax(0, 1fr); }
  .qr { width: 200px; }
}
@media (max-width: 640px) {
  .sub-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sub-stats .stat:last-child { grid-column: 1 / -1; }
  .chips--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chips--3, .chips--periods { grid-template-columns: 1fr; }
  .sublink.is-open { flex-wrap: wrap; padding: 10px 10px 8px 16px; }
  .sublink.is-open code { flex-basis: 100%; }
  .sublink.is-open .icon-btn { margin-left: auto; }
  .cab-top .btn { --h: 40px; padding: 0 16px; font-size: 14px; }
  .balance { font-size: 40px; }
  .cab-login__card { padding: 36px 22px 26px; }
}
