/* ==========================================================================
   Surface: Billing / Premium (#page-billing) + checkout dialog
   (owned by dashboard-core; markup from premium-pricing-153.js)
   Owns: .billing-page, .billing-status(.is-lifetime) (.status-main/-crown/-title/-meter/-actions,
   .status-sub[data-state=active|warning|cancelled] for the Paddle subscription row),
   .billing-section, .perk-grid, .billing-history (r174: .pay-history, .pay-pages, .pay-item, .pay-pager, .pay-empty),
   .plan-compare (.term-toggle, .plan-cards > .plan-card(.is-premium|.is-free), .plan-price, .plan-pay,
   .plan-list, .save, .plan-current-line), details.billing-compare > .billing-compare-body >
   .compare-table > .compare-row, .billing-addons
   (.addon-grid > .addon), .billing-faq, #actionDialog.wallet-checkout-dialog
   (.checkout, .checkout-col, .checkout-block, .checkout-label, .checkout-product,
   .term-grid > .term-option, .method-list > .method-option (.method-sub),
   .checkout-summary, .summary-*, .checkout-blocked, .checkout-consent).
   r181 (unslop): quiet chrome. No washes, glows or icon tiles; icons are bare line icons in the muted role;
   one accent per view (the primary action, the selection dot, the Premium crown); figures at 500.
   ========================================================================== */

@layer surfaces {
  .app-shell .page.billing-page.active {
    display: grid;
    gap: var(--nv-space-5);
  }

  .billing-page > .page-header {
    margin-bottom: 0;
  }

  .billing-section .card-head h2 {
    font-size: var(--nv-fs-18);
  }

  .billing-page .section-title {
    margin: var(--nv-space-2) 0 var(--nv-space-3);
  }

  /* ---- Premium status card --------------------------------------------------- */
  .billing-status {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--nv-space-6);
    padding: var(--nv-space-6);
    overflow: hidden;
  }

  .billing-status.is-loading {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--nv-space-3);
  }

  .status-main {
    display: flex;
    align-items: flex-start;
    gap: var(--nv-space-3);
    min-width: 0;
  }

  /* The crown is a bare accent icon level with the plan name (no tile, no glow). */
  .status-crown {
    display: grid;
    flex: none;
    place-items: center;
    width: 24px;
    height: 24px;
    margin-top: 2px;
    color: var(--nv-accent-text);
  }

  .status-crown .nv-icon {
    width: 24px;
    height: 24px;
  }

  .status-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--nv-space-2) var(--nv-space-3);
  }

  .status-title h2 {
    font-size: var(--nv-fs-22);
  }

  .status-main p {
    margin-top: var(--nv-space-1);
    color: var(--nv-text-2);
    font-size: var(--nv-fs-14);
  }

  .status-main p b {
    color: var(--nv-text);
  }

  .status-meter {
    display: grid;
    gap: var(--nv-space-2);
  }

  .status-meter-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    color: var(--nv-text-2);
    font-size: var(--nv-fs-13);
  }

  /* Figures are set in the figure face (Onest, tabular), 500, no negative tracking: «365 дней», «0 МБ / 50 МБ». */
  .status-meter-head b {
    color: var(--nv-text);
    font-family: var(--nv-font-figure);
    font-size: var(--nv-fs-22);
    font-weight: var(--nv-fw-medium);
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
  }

  .status-meter small {
    color: var(--nv-text-3);
    line-height: var(--nv-lh-ui);
  }

  /* The fill is full width and moved into place with a transform set inline (translateX), never a width. */
  .billing-page .progress > span {
    width: 100%;
  }

  .status-actions {
    position: relative;
    z-index: 1;
    display: grid;
    gap: var(--nv-space-2);
  }

  /* Lifetime: no meter, so the crown block and the gift button share one row. */
  .billing-status.is-lifetime {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  /* Paddle subscription row (auto-renewal on / switched off) under the status. */
  .status-sub {
    position: relative;
    z-index: 1;
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: var(--nv-space-3);
    padding-top: var(--nv-space-4);
    border-top: 1px solid var(--nv-line-soft);
  }

  .status-sub > div {
    display: grid;
    flex: 1;
    gap: 2px;
    min-width: 0;
  }

  .status-sub b {
    color: var(--nv-text);
    font-size: var(--nv-fs-14);
  }

  .status-sub small {
    color: var(--nv-text-3);
    font-size: var(--nv-fs-13);
    line-height: var(--nv-lh-ui);
  }

  .status-sub .status-sub-warn {
    color: var(--nv-warning);
  }

  .status-sub > button {
    flex: none;
  }

  /* The state icon keeps its meaning colour (on = green, off or failing = amber); no tinted tile. */
  .status-sub-icon {
    display: grid;
    flex: none;
    place-items: center;
    width: 20px;
    height: 20px;
    color: var(--nv-success);
  }

  .status-sub-icon .nv-icon {
    width: 20px;
    height: 20px;
  }

  .status-sub[data-state="warning"] .status-sub-icon,
  .status-sub[data-state="cancelled"] .status-sub-icon {
    color: var(--nv-warning);
  }

  /* ---- Perks ------------------------------------------------------------------ */
  .perk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
    gap: var(--nv-space-3);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .perk-grid li,
  .addon {
    display: flex;
    gap: var(--nv-space-3);
  }

  /* A perk's icon sits level with its title; an add-on is one row, centred. */
  .perk-grid li {
    align-items: flex-start;
  }

  .addon {
    align-items: center;
  }

  .perk-grid li > div,
  .addon > div {
    display: grid;
    min-width: 0;
  }

  .perk-grid b,
  .addon b {
    color: var(--nv-text);
    font-size: var(--nv-fs-14);
  }

  .perk-grid small,
  .addon small {
    color: var(--nv-text-3);
    font-size: var(--nv-fs-12);
  }

  /* Perks and add-ons: a bare 18px line icon in the muted role, one column, level with the title. */
  .perk-icon {
    display: grid;
    flex: none;
    place-items: center;
    width: 18px;
    height: 20px;
    color: var(--nv-text-3);
  }

  .perk-icon .nv-icon {
    width: 18px;
    height: 18px;
  }

  /* ---- History (r174) -----------------------------------------------------------
     .billing-history > .pay-history > .pay-pages (scroll-snap strip) > .pay-page > ol.pay-list > li.pay-item
     (.pay-method-icon, .pay-main > .pay-title + .pay-sub, .pay-amount, .pay-meta > .pay-status + .pay-id),
     .pay-pager (.pay-nav, .pay-dots, .pay-count), .pay-empty, .pay-page-error.
     Phones: icon | name + date·method | amount, then status chip + ID under the text.
     Wider: one row — icon | name | status + ID | amount. */
  .billing-history {
    min-width: 0;
  }

  .pay-history {
    display: grid;
    gap: var(--nv-space-3);
    min-width: 0;
  }

  .pay-pages {
    display: grid;
    grid-auto-columns: 100%;
    grid-auto-flow: column;
    align-items: start;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--nv-r-sm);
  }

  .pay-pages::-webkit-scrollbar {
    display: none;
  }

  .pay-pages:focus-visible {
    outline: 2px solid var(--nv-focus, var(--nv-accent));
    outline-offset: -2px;
  }

  .pay-page {
    min-width: 0;
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }

  .pay-list {
    display: grid;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .pay-item {
    display: grid;
    grid-template-areas:
      "icon main amount"
      "icon meta meta";
    grid-template-columns: 36px minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--nv-space-1) var(--nv-space-3);
    min-width: 0;
    padding: var(--nv-space-3) 0;
    border-top: 1px solid var(--nv-line-soft);
  }

  .pay-item:first-child {
    border-top: 0;
  }

  .pay-method-icon {
    grid-area: icon;
    align-self: start;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    overflow: hidden;
    border: 1px solid var(--nv-line-soft);
    border-radius: var(--nv-r-sm);
    background: var(--nv-surface-3);
    color: var(--nv-text-3);
  }

  .pay-method-icon :is(img, svg) {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .pay-method-icon .nv-icon {
    width: 18px;
    height: 18px;
  }

  .pay-main {
    grid-area: main;
    display: grid;
    gap: 2px;
    min-width: 0;
  }

  .pay-title {
    color: var(--nv-text);
    font-size: var(--nv-fs-14);
    font-weight: var(--nv-fw-medium);
    line-height: 1.3;
    overflow-wrap: anywhere;
  }

  .pay-sub {
    display: block;
    min-width: 0;
    color: var(--nv-text-3);
    font-size: var(--nv-fs-12);
    line-height: 1.4;
  }

  .pay-method-name::before {
    content: " · ";
  }

  .pay-amount {
    grid-area: amount;
    align-self: start;
    color: var(--nv-text);
    font-family: var(--nv-font-figure);
    font-size: var(--nv-fs-14);
    font-weight: var(--nv-fw-medium);
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
  }

  .pay-meta {
    grid-area: meta;
    display: flex;
    align-items: center;
    gap: var(--nv-space-2);
    min-width: 0;
  }

  .pay-status {
    flex: none;
    white-space: nowrap;
  }

  .pay-item[data-status="refunded"] .pay-amount,
  .pay-item[data-status="chargeback"] .pay-amount,
  .pay-item:is([data-status="expired"], [data-status="unpaid"], [data-status="failed"]) .pay-amount {
    color: var(--nv-text-3);
    text-decoration: line-through;
    text-decoration-thickness: 1px;
  }

  .pay-id {
    display: inline-flex;
    align-items: center;
    flex: 0 1 auto;
    gap: var(--nv-space-2);
    min-width: 0;
    max-width: 100%;
    min-height: 40px;
    margin-left: auto;
    padding: 0 var(--nv-space-2);
    border: 0;
    border-radius: var(--nv-r-xs);
    background: transparent;
    color: var(--nv-text-3);
    font-size: var(--nv-fs-12);
    cursor: pointer;
    transition: background-color var(--nv-dur-1) var(--nv-ease), color var(--nv-dur-1) var(--nv-ease);
  }

  .pay-id:hover {
    background: var(--nv-surface-3);
    color: var(--nv-text);
  }

  .pay-id:focus-visible {
    outline: 2px solid var(--nv-focus, var(--nv-accent));
    outline-offset: 1px;
  }

  .pay-id-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .pay-id .nv-icon {
    flex: none;
    width: 16px;
    height: 16px;
  }

  /* Pager: prev · dots + «1 из N» · next. Dots are only a picture; the buttons and the count do the work. */
  .pay-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--nv-space-3);
    padding-top: var(--nv-space-3);
    border-top: 1px solid var(--nv-line-soft);
  }

  .pay-nav.icon-btn {
    width: 44px;
    min-width: 44px;
    height: 44px;
  }

  .pay-nav .pay-chev {
    display: grid;
    place-items: center;
  }

  .pay-nav .pay-chev.is-prev {
    transform: scaleX(-1);
  }

  .pay-nav .nv-icon {
    width: 18px;
    height: 18px;
  }

  .pay-pager-mid {
    display: grid;
    justify-items: center;
    gap: var(--nv-space-2);
    min-width: 0;
  }

  /* The current page is the accent dot; every dot keeps its size (only the colour changes). */
  .pay-dots {
    display: flex;
    gap: var(--nv-space-2);
  }

  .pay-dots i {
    width: 6px;
    height: 6px;
    border-radius: var(--nv-r-round);
    background: var(--nv-surface-4);
    transition: background-color var(--nv-dur-2) var(--nv-ease);
  }

  .pay-dots i.is-on {
    background: var(--nv-accent);
  }

  .pay-count {
    color: var(--nv-text-3);
    font-family: var(--nv-font-mono);
    font-size: var(--nv-fs-12);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  /* Empty, loading and a page that failed to load. */
  .pay-empty {
    display: grid;
    justify-items: center;
    gap: var(--nv-space-2);
    padding: var(--nv-space-6) var(--nv-space-4);
    border: 1px dashed var(--nv-line);
    border-radius: var(--nv-r-md);
    color: var(--nv-text-3);
    font-size: var(--nv-fs-13);
    text-align: center;
  }

  .pay-empty b {
    color: var(--nv-text);
    font-size: var(--nv-fs-14);
  }

  .pay-empty-icon {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    margin-bottom: var(--nv-space-1);
    color: var(--nv-text-3);
  }

  .pay-empty-icon .nv-icon {
    width: 24px;
    height: 24px;
  }

  .pay-item.is-skeleton {
    grid-template-areas: "icon main amount";
  }

  .pay-item.is-skeleton .pay-main {
    gap: 8px;
  }

  .pay-item .skeleton.text.short {
    width: 55%;
  }

  .pay-sk-icon {
    grid-area: icon;
    width: 36px;
    height: 36px;
    border-radius: var(--nv-r-sm);
  }

  .pay-sk-amount {
    grid-area: amount;
    width: 52px;
    height: 16px;
    border-radius: var(--nv-r-xs);
  }

  .billing-history.is-loading .skeleton.title {
    width: 160px;
  }

  .pay-page-error {
    display: grid;
    justify-items: center;
    gap: var(--nv-space-2);
    padding: var(--nv-space-6) var(--nv-space-4);
    color: var(--nv-text-2);
    font-size: var(--nv-fs-13);
    text-align: center;
  }

  .pay-page-error > .nv-icon {
    width: 20px;
    height: 20px;
    color: var(--nv-danger);
  }

  .billing-history .card-head {
    flex-wrap: wrap;
  }

  .billing-history .card-head > a {
    white-space: nowrap;
  }

  @media (max-width: 640px) {
    /* The policy link wraps under the title: line its icon up with the text above. */
    .billing-history .card-head > a {
      margin-left: calc(-1 * var(--nv-space-3));
    }
  }

  @media (min-width: 761px) {
    .pay-item {
      grid-template-areas: "icon main meta amount";
      grid-template-columns: 36px minmax(0, 1fr) auto minmax(84px, auto);
      gap: var(--nv-space-4);
    }

    .pay-meta {
      justify-content: flex-end;
    }

    .pay-id {
      max-width: 170px;
      margin-left: 0;
      border: 1px solid var(--nv-line-soft);
    }

    .pay-amount {
      align-self: center;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .pay-dots i {
      transition: none;
    }
  }

  /* ---- Free: plan comparison --------------------------------------------------- */
  .plan-compare {
    display: grid;
    gap: var(--nv-space-4);
  }

  .term-toggle {
    display: flex;
    justify-content: center;
  }

  .term-toggle .segmented > button {
    min-height: 36px;
    padding: 4px 16px;
  }

  /* «как 2,5 года»: the saving is quiet green text after the term, not a pill. */
  .save {
    margin-left: var(--nv-space-1);
    color: var(--nv-success);
    font-size: var(--nv-fs-12);
    font-weight: var(--nv-fw-regular);
  }

  .plan-cards {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: var(--nv-space-4);
    align-items: stretch;
  }

  .plan-card {
    display: flex;
    flex-direction: column;
    gap: var(--nv-space-3);
    padding: var(--nv-space-6);
    overflow: hidden;
  }

  .plan-card > p {
    color: var(--nv-text-2);
    font-size: var(--nv-fs-14);
  }

  .plan-price {
    display: flex;
    align-items: baseline;
    gap: var(--nv-space-2);
  }

  .plan-price b {
    color: var(--nv-text);
    font-family: var(--nv-font-figure);
    font-size: var(--nv-fs-48);
    font-weight: var(--nv-fw-medium);
    line-height: 1;
    letter-spacing: -.01em;
    font-variant-numeric: tabular-nums;
  }

  .plan-price small {
    color: var(--nv-text-3);
    font-size: var(--nv-fs-14);
  }

  .plan-list {
    display: grid;
    gap: var(--nv-space-2);
    margin: var(--nv-space-2) 0 var(--nv-space-4);
    padding: 0;
    list-style: none;
  }

  .plan-list li {
    display: flex;
    align-items: flex-start;
    gap: var(--nv-space-2);
    color: var(--nv-text-2);
    font-size: var(--nv-fs-14);
  }

  .plan-list .nv-icon {
    flex: none;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    color: var(--nv-text-3);
  }

  .plan-card.is-premium .plan-list li {
    color: var(--nv-text);
  }

  .plan-card.is-premium .plan-list .nv-icon {
    color: var(--nv-text-2);
  }

  .plan-card > :is(.primary, .plan-current) {
    margin-top: auto;
  }

  /* Premium is first in the DOM; two columns keep Free left, Premium right (r164). */
  .plan-card.is-free {
    grid-row: 1;
    grid-column: 1;
  }

  .plan-card.is-premium {
    grid-row: 1;
    grid-column: 2;
  }

  /* Under the Premium price: two short payment lines (the checkout dialog has the details). */
  .plan-pay {
    display: grid;
    gap: var(--nv-space-2);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .plan-pay li {
    display: flex;
    align-items: center;
    gap: var(--nv-space-2);
    color: var(--nv-text-2);
    font-size: var(--nv-fs-13);
    line-height: 1.35;
  }

  .plan-pay .nv-icon {
    flex: none;
    width: 16px;
    height: 16px;
    color: var(--nv-text-3);
  }

  /* Phones: the Free card becomes this one line (hidden on wider screens). */
  .plan-current-line {
    display: none;
  }

  /* «Сравнить планы»: the comparison table opens on demand. */
  .billing-compare > .billing-compare-body {
    padding: 0 var(--nv-space-3) var(--nv-space-3);
  }

  .plan-current {
    align-self: flex-start;
  }

  .compare-table {
    display: grid;
    border: 1px solid var(--nv-line);
    border-radius: var(--nv-r-md);
    overflow: hidden;
  }

  .compare-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 96px 112px;
    align-items: center;
    min-height: 48px;
    padding: 0 var(--nv-space-4);
    color: var(--nv-text-2);
    font-size: var(--nv-fs-14);
  }

  .compare-row + .compare-row {
    border-top: 1px solid var(--nv-line-soft);
  }

  .compare-row > span:not(:first-child) {
    display: flex;
    justify-content: center;
  }

  /* Free reads muted, Premium reads bright: the difference is the column, not orange on every cell. */
  .compare-head {
    min-height: 40px;
    background: var(--nv-surface-2);
    color: var(--nv-text-3);
    font-size: var(--nv-fs-12);
    font-weight: var(--nv-fw-medium);
  }

  .compare-head > span:last-child {
    color: var(--nv-text);
  }

  .compare-row .is-pro {
    color: var(--nv-text);
  }

  /* «—» (not in this plan) is read, not decoration: the muted role keeps it at 4.5:1. */
  .compare-row .is-no {
    color: var(--nv-text-3);
  }

  .compare-row .nv-icon {
    width: 18px;
    height: 18px;
  }

  .compare-row b {
    color: var(--nv-text-2);
    font-weight: var(--nv-fw-regular);
    font-variant-numeric: tabular-nums;
  }

  .compare-row .is-pro b {
    color: var(--nv-text);
    font-weight: var(--nv-fw-medium);
  }

  /* Four add-ons since release 167 (extra storage): 2 × 2 reads better than 3 + 1. */
  .addon-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--nv-space-3);
  }

  .addon {
    padding: var(--nv-space-4);
  }

  .addon > div {
    flex: 1;
  }

  .addon > .nv-icon {
    width: 18px;
    height: 18px;
    color: var(--nv-text-3);
  }

  .billing-faq {
    display: grid;
    gap: var(--nv-space-2);
  }

  /* ---- Checkout dialog --------------------------------------------------------- */
  #actionDialog.wallet-checkout-dialog {
    --dialog-w: 780px;
  }

  .checkout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: var(--nv-space-5);
    align-items: start;
  }

  .checkout-col {
    display: grid;
    gap: var(--nv-space-5);
    min-width: 0;
  }

  .checkout-block {
    display: grid;
    gap: var(--nv-space-3);
  }

  .checkout-block legend {
    margin-bottom: var(--nv-space-3);
    color: var(--nv-text);
    font-size: var(--nv-fs-14);
    font-weight: var(--nv-fw-medium);
  }

  .term-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--nv-space-2);
  }

  /* Every choice in the checkout shows the same radio dot (top right here, at the end of a method row);
     the chosen one is a surface step with an accent hairline. No ring, no glow. */
  .term-option {
    position: relative;
    display: grid;
    justify-items: start;
    gap: 2px;
    padding: var(--nv-space-3) calc(var(--nv-space-3) + 28px) var(--nv-space-3) var(--nv-space-3);
    border: 1px solid var(--nv-line-strong);
    border-radius: var(--nv-r-md);
    background: var(--nv-surface-2);
    text-align: left;
    transition: border-color var(--nv-dur-1) var(--nv-ease), background-color var(--nv-dur-1) var(--nv-ease);
  }

  .term-option::after {
    content: "";
    position: absolute;
    top: var(--nv-space-3);
    right: var(--nv-space-3);
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--nv-text-disabled);
    border-radius: var(--nv-r-round);
  }

  .term-option[aria-checked="true"]::after {
    border-color: var(--nv-accent);
    background: radial-gradient(circle, var(--nv-accent) 0 4px, transparent 4.5px);
  }

  .term-option b {
    color: var(--nv-text);
    font-size: var(--nv-fs-14);
  }

  .term-option span {
    color: var(--nv-text);
    font-family: var(--nv-font-figure);
    font-size: var(--nv-fs-18);
    font-weight: var(--nv-fw-medium);
    font-variant-numeric: tabular-nums;
  }

  .term-option small {
    color: var(--nv-success);
    font-size: var(--nv-fs-12);
    font-weight: var(--nv-fw-regular);
  }

  .term-option small.is-muted {
    color: var(--nv-text-3);
  }

  .method-text .method-sub {
    color: var(--nv-text-2);
  }

  /* Product checkout (short address): what is being bought, in place of the term picker. */
  .checkout-label {
    color: var(--nv-text);
    font-size: var(--nv-fs-14);
    font-weight: var(--nv-fw-medium);
  }

  .checkout-product {
    display: flex;
    align-items: center;
    gap: var(--nv-space-3);
    padding: var(--nv-space-3);
    border: 1px solid var(--nv-line-strong);
    border-radius: var(--nv-r-md);
    background: var(--nv-surface-2);
  }

  .checkout-product > div {
    display: grid;
    gap: 2px;
    min-width: 0;
  }

  /* The address being bought is the signature: mono, the host dim, the name bright. */
  .checkout-product b {
    overflow-wrap: anywhere;
    white-space: normal; /* .nv-address does not wrap; this one may, on the narrowest phones */
    color: var(--nv-address-name);
    font-family: var(--nv-address-font);
    font-size: var(--nv-fs-16);
    font-weight: var(--nv-fw-medium);
  }

  .checkout-product b .nv-address-host {
    color: var(--nv-address-host);
    font-weight: var(--nv-fw-regular);
  }

  .checkout-product small {
    color: var(--nv-text-2);
    font-size: var(--nv-fs-12);
    line-height: var(--nv-lh-ui);
  }

  /* Release 167: quantity of a yearly add-on (storage packs, extra pages). */
  .qty-stepper {
    display: flex;
    align-items: center;
    gap: var(--nv-space-2);
  }

  .qty-stepper input {
    width: 88px;
    font-family: var(--nv-font-figure);
    font-size: var(--nv-fs-16);
    font-variant-numeric: tabular-nums;
    text-align: center;
    -moz-appearance: textfield;
  }

  .qty-stepper input::-webkit-inner-spin-button,
  .qty-stepper input::-webkit-outer-spin-button {
    margin: 0;
    -webkit-appearance: none;
  }

  .qty-stepper .icon-btn svg {
    width: 16px;
    height: 16px;
  }

  /* Release 167: «Место для файлов» — shared quota meter and the packs bought. */
  .billing-storage .status-meter.is-full .progress > span {
    background: var(--nv-danger);
  }

  /* r181: a button or link in a card head keeps its own label: the card-head caption rule (block, muted, 13px)
     is meant for the subtitle, not for «Докупить место» / «Оплата и возвраты». */
  .billing-section .card-head > :is(a, button) > span {
    display: inline;
    margin-top: 0;
    color: inherit;
    font-size: inherit;
  }

  .billing-storage .card-head > button {
    flex: none;
    white-space: nowrap;
  }

  /* Phones: the action takes its own row under the title, on one line, with the full touch target. */
  @media (max-width: 640px) {
    .billing-storage .card-head {
      flex-wrap: wrap;
    }

    .billing-storage .card-head > button {
      flex: 1 1 100%;
    }
  }

  @media (pointer: coarse) {
    .billing-storage .card-head > button {
      min-height: var(--nv-hit);
    }
  }

  .storage-packs {
    display: grid;
    gap: var(--nv-space-2);
    margin: var(--nv-space-3) 0 0;
    padding: 0;
    list-style: none;
  }

  .storage-packs li {
    display: flex;
    align-items: center;
    gap: var(--nv-space-2);
    color: var(--nv-text-2);
    font-size: var(--nv-fs-13);
  }

  .storage-packs li > svg {
    flex: none;
    width: 16px;
    height: 16px;
    color: var(--nv-text-3);
  }

  .storage-packs b {
    color: var(--nv-text);
    font-variant-numeric: tabular-nums;
  }

  .term-option:hover,
  .method-option:hover {
    border-color: var(--nv-field-line-hover);
    background: var(--nv-surface-3);
  }

  .term-option[aria-checked="true"],
  .method-option[aria-checked="true"] {
    border-color: var(--nv-accent-line);
    background: var(--nv-surface-3);
  }

  .method-list {
    display: grid;
    gap: var(--nv-space-2);
  }

  .method-option {
    display: flex;
    align-items: center;
    gap: var(--nv-space-3);
    min-height: 56px;
    padding: var(--nv-space-2) var(--nv-space-4) var(--nv-space-2) var(--nv-space-2);
    border: 1px solid var(--nv-line-strong);
    border-radius: var(--nv-r-md);
    background: var(--nv-surface-2);
    text-align: left;
    transition: border-color var(--nv-dur-1) var(--nv-ease), background-color var(--nv-dur-1) var(--nv-ease);
  }

  /* The provider's own logo; nested in the 12px row with 8px padding, so its corners are the 6px step. */
  .method-icon {
    display: grid;
    flex: none;
    place-items: center;
    width: 40px;
    height: 40px;
    overflow: hidden;
    border-radius: var(--nv-r-xs);
    background: var(--nv-surface-3);
    color: var(--nv-text-3);
  }

  .method-icon :is(img, svg) {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .method-icon .nv-icon {
    width: 18px;
    height: 18px;
  }

  .method-text {
    display: grid;
    flex: 1;
    min-width: 0;
  }

  .method-text b {
    color: var(--nv-text);
    font-size: var(--nv-fs-14);
  }

  .method-text small {
    color: var(--nv-text-3);
    font-size: var(--nv-fs-12);
  }

  .method-radio {
    flex: none;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--nv-text-disabled);
    border-radius: var(--nv-r-round);
  }

  .method-option[aria-checked="true"] .method-radio {
    border-color: var(--nv-accent);
    background: radial-gradient(circle, var(--nv-accent) 0 4px, transparent 4.5px);
  }

  .checkout-summary {
    position: sticky;
    top: 0;
    display: grid;
    gap: var(--nv-space-3);
    padding: var(--nv-space-5);
  }

  .summary-row,
  .summary-total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--nv-space-3);
    color: var(--nv-text-2);
    font-size: var(--nv-fs-14);
  }

  .summary-row b {
    color: var(--nv-text);
  }

  .summary-total {
    padding-top: var(--nv-space-3);
    border-top: 1px solid var(--nv-line);
  }

  .summary-total strong {
    color: var(--nv-text);
    font-family: var(--nv-font-figure);
    font-size: var(--nv-fs-28);
    font-weight: var(--nv-fw-medium);
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
  }

  .summary-total strong small {
    color: var(--nv-text-3);
    font-family: var(--nv-font-sans);
    font-size: var(--nv-fs-14);
    font-weight: var(--nv-fw-regular);
  }

  .checkout-blocked {
    font-size: var(--nv-fs-12);
  }

  .checkout-consent {
    color: var(--nv-text-2);
    font-size: var(--nv-fs-12);
    line-height: var(--nv-lh-ui);
    text-align: center;
  }

  .summary-notes {
    display: grid;
    gap: var(--nv-space-2);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .summary-notes li {
    display: flex;
    align-items: center;
    gap: var(--nv-space-2);
    color: var(--nv-text-3);
    font-size: var(--nv-fs-12);
  }

  /* Facts about the payment, not statuses: the icons take the muted text role. */
  .summary-notes .nv-icon {
    flex: none;
    width: 16px;
    height: 16px;
    color: var(--nv-text-3);
  }

  /* «Оформить подписку · $3.99/год» is the longest label: it may wrap rather than overflow the card. */
  .checkout-summary .primary {
    --btn-px: 16px;
    min-width: 0;
    font-size: var(--nv-fs-14);
    white-space: normal;
    text-wrap: balance;
  }

  .checkout-policy {
    color: var(--nv-text-3);
    font-size: var(--nv-fs-12);
    text-align: center;
  }

  /* ---- Responsive -------------------------------------------------------------- */
  @media (max-width: 1100px) {
    .billing-status {
      grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .status-actions {
      grid-column: 1 / -1;
      grid-template-columns: repeat(3, max-content);
    }

    .billing-status.is-lifetime .status-actions {
      grid-column: auto;
    }
  }

  @media (max-width: 760px) {
    .billing-status,
    .plan-cards,
    .addon-grid,
    .checkout {
      grid-template-columns: minmax(0, 1fr);
    }

    /* One column: DOM order, Premium first. */
    .plan-card.is-free,
    .plan-card.is-premium {
      grid-row: auto;
      grid-column: auto;
    }

    .billing-status {
      padding: var(--nv-space-5);
    }

    .status-actions {
      grid-template-columns: 1fr 1fr;
    }

    /* Extend + gift side by side, the longer «Навсегда за $9.99» full width under them. */
    .status-actions > .status-lifetime {
      grid-column: 1 / -1;
      order: 1;
    }

    .billing-status.is-lifetime .status-actions {
      grid-column: 1 / -1;
      grid-template-columns: minmax(0, 1fr);
    }

    .status-sub {
      flex-wrap: wrap;
    }

    .status-sub > div {
      flex-basis: calc(100% - 20px - var(--nv-space-3));
    }

    .status-sub > button {
      flex: 1 1 100%;
    }

    .checkout-summary {
      position: static;
    }

    .compare-row {
      grid-template-columns: minmax(0, 1fr) 64px 76px;
      padding: 0 var(--nv-space-3);
      font-size: var(--nv-fs-13);
    }

    .term-toggle .segmented {
      width: 100%;
    }

    .term-toggle .segmented > button {
      padding: 4px 8px;
    }
  }

  @media (max-width: 420px) {
    .term-grid {
      grid-template-columns: minmax(0, 1fr);
    }

    .term-option {
      grid-template-columns: 1fr auto auto;
      align-items: baseline;
      gap: var(--nv-space-3);
    }
  }

  /* ---- Phones: compact + calm (r160, r181) -------------------------------------------
     Perks two-up with the same bare icons, shorter plan cards and rows. Figures follow the
     phone type scale of the tokens (22 → 20, 48 → 32). */
  @media (max-width: 640px) {
    .app-shell .page.billing-page.active {
      gap: var(--nv-space-3);
    }

    .billing-section .card-head h2 {
      font-size: var(--nv-fs-16);
    }

    .billing-status {
      gap: var(--nv-space-3);
      padding: var(--nv-space-4);
    }

    .status-title {
      gap: var(--nv-space-1) var(--nv-space-2);
    }

    .status-main p {
      margin-top: 2px;
      font-size: var(--nv-fs-13);
    }

    .status-meter small {
      font-size: var(--nv-fs-12);
    }

    .perk-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: var(--nv-space-2) var(--nv-space-3);
    }

    .perk-grid li {
      align-items: flex-start;
      gap: var(--nv-space-2);
    }

    .addon {
      padding: var(--nv-space-3);
    }

    .perk-grid b,
    .addon b {
      font-size: var(--nv-fs-13);
      line-height: 1.3;
    }

    .perk-grid small,
    .addon small {
      font-size: var(--nv-fs-12);
      line-height: 1.35;
    }

    /* r166 (C1): checkout. The radio dot (drawn for every viewport above) sits in the middle of the row here.
       The summary loses the «Итого» label and the product line (both are the choice right above), so the
       pay button comes up onto the first screen. */
    .term-option::after {
      top: 50%;
      transform: translateY(-50%);
    }

    .checkout-summary {
      gap: var(--nv-space-2);
      padding: var(--nv-space-4);
    }

    .checkout-summary > .eyebrow,
    .checkout-summary > .summary-row {
      display: none;
    }

    .checkout-summary .summary-total {
      padding-top: 0;
      border-top: 0;
    }

    /* The 13px perk titles take the 16px icon of the same set, still level with the first line. */
    .perk-icon {
      width: 16px;
      height: 18px;
    }

    .perk-icon .nv-icon {
      width: 16px;
      height: 16px;
    }

    .plan-compare {
      gap: var(--nv-space-3);
    }

    .plan-cards {
      gap: var(--nv-space-3);
    }

    .plan-card {
      gap: var(--nv-space-2);
      padding: var(--nv-space-4);
    }

    .plan-card > p {
      font-size: var(--nv-fs-13);
    }

    .plan-list {
      gap: var(--nv-space-2);
      margin: var(--nv-space-1) 0 var(--nv-space-3);
    }

    .plan-list li {
      font-size: var(--nv-fs-13);
    }

    .plan-list .nv-icon,
    .addon > .nv-icon {
      width: 16px;
      height: 16px;
    }

    .compare-row {
      min-height: 40px;
    }

    .addon-grid {
      gap: var(--nv-space-2);
    }

    /* r164: Premium first, Free as the one line «Ваш план: Free». */
    .plan-card.is-free {
      display: none;
    }

    .plan-current-line {
      display: flex;
      align-items: center;
      gap: var(--nv-space-2);
      min-height: 44px;
      padding: 0 var(--nv-space-4);
      border: 1px solid var(--nv-line);
      border-radius: var(--nv-r-md);
      background: var(--nv-surface-1);
      color: var(--nv-text-2);
      font-size: var(--nv-fs-14);
    }

    .plan-current-line > .nv-icon {
      flex: none;
      width: 16px;
      height: 16px;
      color: var(--nv-text-3);
    }

    .plan-current-line b {
      color: var(--nv-text);
    }

    .plan-current-line > small {
      margin-left: auto;
      color: var(--nv-text-3);
      font-size: var(--nv-fs-12);
    }

    .plan-card.is-premium .plan-list {
      margin-bottom: var(--nv-space-2);
    }

    .billing-compare > .billing-compare-body {
      padding: 0 var(--nv-space-2) var(--nv-space-2);
    }
  }

  /* ---- Gift links (r180) ------------------------------------------------------------
     A reissued link opens as a full-width read-only field (it may be the only copy when the
     clipboard is blocked). On phones the row wraps: title and id on top, state and actions
     below, so neither the gift name nor «Новая ссылка» is cut. */
  .gift-url:not([hidden]) {
    display: block;
    margin-top: var(--nv-space-2);
  }

  .gift-url input {
    width: 100%;
    font-family: var(--nv-font-mono);
  }

  [data-gifts] .list-row-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  /* The payment ID is set like the IDs in the history: the figure face. */
  [data-gifts] .list-row-body small > [data-no-i18n] {
    font-family: var(--nv-font-mono);
  }

  /* 409 «unconfirmed» in the gift checkout: send anyway, or as a gift link. */
  .checkout-error-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--nv-space-2);
    margin-top: var(--nv-space-2);
  }

  @media (max-width: 640px) {
    [data-gifts] .list-row {
      flex-wrap: wrap;
      row-gap: var(--nv-space-2);
    }

    [data-gifts] .list-row-body {
      flex: 1 1 calc(100% - 48px);
    }

    [data-gifts] .list-row-actions {
      width: 100%;
      padding-left: 48px;
    }
  }
}
