@layer pages {
    /* ============================================================================
       Profile — страница профиля: тизер «Мой стиль» + карточка тарифа + поля
       центр-пикера паспорта. Scoped to the profile page only.

       Весь хром паспорт-шита (#pp-modal: шелл/hero/футбар/блоки/строки/свотчи/
       шкалы) — ОБЩИЙ язык css/card-sheet.css; здесь только то, что принадлежит
       именно профилю.
       ========================================================================== */

    /* ── Teaser card (opens the passport sheet) ───────────────────────────── */
    .prof-teaser {
        display: flex;
        align-items: center;
        gap: 13px;
        width: 100%;
        padding: 15px;
        /* One section-card surface across the page (= the plan card): solid white +
           hairline. Glass/accent tints stayed inconsistent between the three cards. */
        background: #fff;
        border: 1px solid var(--hairline);
        border-radius: var(--radius-md);
        box-shadow: 0 8px 30px rgba(17, 21, 34, 0.07);
        cursor: pointer;
        font-family: inherit;
        color: var(--text);
        text-align: left;
        transition: transform 0.12s;
    }

    .prof-teaser:active {
        transform: scale(0.99);
    }

    .prof-teaser-ph {
        width: 52px;
        height: 52px;
        border-radius: 13px;
        overflow: hidden;
        flex: none;
        background: linear-gradient(150deg, #cdd6e8, #e6dcec 60%, #d6e2ea);
    }

    .prof-teaser-ph img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

    .prof-teaser-tx {
        display: flex;
        flex-direction: column;
        gap: 4px;
        min-width: 0;
        flex: 1;
    }

    .prof-teaser-tx b {
        font-family: var(--font-heading);
        font-weight: 700;
        font-size: 17px;
        letter-spacing: -0.01em;
        line-height: 1.1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .prof-teaser-sub {
        display: flex;
        align-items: center;
        gap: 5px;
        font-size: 12px;
        color: var(--text-secondary);
        min-width: 0;
        overflow: hidden;
    }

    .prof-teaser-sub .pp-mini-sw {
        width: 16px;
        height: 16px;
        border-radius: 5px;
        flex: none;
        box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.07);
    }

    /* Loading: dim the teaser until profile.js fills it + drops .is-loading */
    .prof-style-section.is-loading .prof-teaser {
        opacity: 0.55;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    /* ── Field editor (#pp-ed-modal) — скин общий (cs-ed, card-sheet.css).
       Профильная специфика: у размеров — value-инпут + дропдаун единицы (зеркало
       money+currency карточки вещи); высота textarea. ── */
    #pp-ed-modal .cs-ed-money {
        display: flex;
        gap: 8px;
        align-items: center;
    }

    #pp-ed-modal .cs-ed-money .cs-ed-amt {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
    }

    /* Unit badge = tap-to-cycle (same as the item card's currency button). */
    #pp-ed-modal .ie-cur-cycle {
        flex: 0 0 auto;
        min-width: 56px;
        padding: 11px 12px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 1px solid rgba(0, 0, 0, 0.1);
        border-radius: 11px;
        background: #fff;
        font: inherit;
        font-weight: 700;
        font-size: 15px;
        color: var(--text);
        cursor: pointer;
        white-space: nowrap;
        transition: border-color 0.15s, box-shadow 0.15s;
    }

    #pp-ed-modal .ie-cur-cycle:active {
        border-color: var(--accent);
        box-shadow: 0 0 0 3px var(--accent-10);
    }

    #pp-ed-modal .ie-cur-cycle > span {
        display: inline-block;
    }

    #pp-ed-modal .ie-cur-cycle > span.bump {
        animation: ieCurBump 0.22s ease;
    }

    #pp-ed-modal textarea.cs-ed-inp {
        min-height: 96px;
    }

    /* ── Тариф (plan) — compact card matching the passport; overrides the
       glassy style.css card. ────── */
    .prof-plan-card {
        background: #fff;
        border: 1px solid var(--hairline);
        border-radius: 20px;
        box-shadow: 0 8px 30px rgba(17, 21, 34, 0.07);
        padding: 18px 20px;
        gap: 14px;
    }

    /* Settings menu — same white section-card as the plan (was glass 0.5). */
    .prof-menu {
        background: #fff;
        border: 1px solid var(--hairline);
        box-shadow: 0 8px 30px rgba(17, 21, 34, 0.07);
    }

    .prof-plan-meter-master span {
        background: linear-gradient(90deg, var(--accent), #9b8cf0);
    }

    /* Breakdown stays a 2-column grid at every width (chips are short:
       dot + feature + number) — reads better than one tall column. */

    /* ── Passport sheet — profile-only bits over the shared cs-* chrome ─────────
       Rows/blocks/swatches/foot come from card-sheet.css; here only what belongs
       to the passport: row icons, the analysis «камни», eye/hair colour dots,
       the palette→analysis divider, and the date corner-stamp. Scoped to #pp-modal
       so item/outfit sheets that share cs-row/cs-k are untouched. */

    /* Row leads with a soft-lilac icon box (Внешность / Параметры). */
    #pp-modal .cs-k {
        display: inline-flex;
        align-items: center;
        gap: 11px;
    }

    .pp-ico {
        width: 30px;
        height: 30px;
        flex: none;
        border-radius: 9px;
        background: var(--accent-10);
        color: var(--accent);
        display: grid;
        place-items: center;
    }

    .pp-ico svg {
        width: 17px;
        height: 17px;
    }

    /* Value-side colour chip — ONE shape/size for every row that carries a colour:
       the analysis «камень» (undertone/depth/contrast/metals) and the eye/hair dot.
       Colour is set inline from config swatches; the inset highlight gives the sheen. */
    .pp-gem,
    .pp-cdot {
        width: 20px;
        height: 20px;
        flex: none;
        border-radius: 50%;
        box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12),
                    inset 2px 2px 5px rgba(255, 255, 255, 0.5);
    }

    /* Hairline between the palette and the analysis rows inside «Цветотип». */
    .pp-cdiv {
        height: 1px;
        background: rgba(0, 0, 0, 0.06);
        margin: 14px 0;
    }

    /* The divider already separates palette from analysis — kill the first
       analysis row's own hairline so it isn't a double line. */
    .pp-cdiv + .cs-row {
        border-top: 0;
    }

    /* Date as a corner stamp on the hero (replaces the bottom glass pill). */
    .pp-stamp {
        position: absolute;
        top: 12px;
        right: 12px;
        z-index: 4;
        display: inline-flex;
        align-items: center;
        gap: 5px;
        padding: 6px 10px;
        border-radius: 9px;
        font-size: 10px;
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: #fff;
        background: rgba(20, 16, 34, 0.42);
        border: 1px solid rgba(255, 255, 255, 0.25);
        -webkit-backdrop-filter: blur(6px);
        backdrop-filter: blur(6px);
    }

    .pp-stamp svg {
        width: 12px;
        height: 12px;
    }

    /* ============================================================================
       PLAN — minimal plaque (trigger) + plan card-sheet (Гардероб / Затраты / Тариф).
       The plaque opens #plan-sheet; the sheet chrome (shell/grab/scroll, responsive
       desktop-modal / mobile-sheet) is the shared card-sheet.css language, here only
       the plan-specific hero / attribute blocks / spend rows.
       ========================================================================== */
    .prof-plan-plaque {
        display: flex;
        align-items: center;
        gap: 14px;
        width: 100%;
        padding: 16px 18px;
        background: #fff;
        border: 1px solid var(--hairline);
        border-radius: var(--radius-md);
        box-shadow: 0 8px 30px rgba(17, 21, 34, 0.07);
        cursor: pointer;
        font-family: inherit;
        color: var(--text);
        text-align: left;
        transition: transform 0.12s;
    }

    .prof-plan-plaque:active {
        transform: scale(0.99);
    }

    .ppl-main {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .ppl-top {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }

    .ppl-cr {
        display: flex;
        align-items: baseline;
        gap: 8px;
    }

    .ppl-bolt {
        font-size: var(--font-lg);
        line-height: 1;
        align-self: center;
    }

    .ppl-cr strong {
        font-family: 'Space Grotesk', sans-serif;
        font-size: var(--font-2xl);
        font-weight: 700;
        line-height: 1;
        letter-spacing: -0.02em;
        font-variant-numeric: tabular-nums;
        color: var(--text);
    }

    .ppl-plan {
        font-weight: 700;
        font-size: var(--font-base);
        color: var(--accent);
        white-space: nowrap;
    }

    .prof-plan-plaque .prof-plan-meter {
        height: 7px;
    }

    /* Waiting on /api/me/subscription. The plaque keeps its size (it's in the
       markup), but the two values are blank until then — printing a placeholder
       plan meant a Free user saw "Plus" flash first. Bars stand in instead, and
       the tap is disabled so the sheet can't open on empty data. */
    .prof-plan-plaque.is-loading {
        pointer-events: none;
    }

    .prof-plan-plaque.is-loading .ppl-cr strong::after,
    .prof-plan-plaque.is-loading .ppl-plan::after {
        content: "";
        display: inline-block;
        height: 0.8em;
        border-radius: 5px;
        background: currentColor;
        animation: pplSkeleton 1.2s ease-in-out infinite;
    }

    .prof-plan-plaque.is-loading .ppl-cr strong::after {
        width: 2.2ch;
    }

    .prof-plan-plaque.is-loading .ppl-plan::after {
        width: 4ch;
    }

    /* The price is empty while loading, but its "· " separator would still print. */
    .prof-plan-plaque.is-loading .ppl-price::before {
        content: none;
    }

    @keyframes pplSkeleton {
        0%, 100% { opacity: 0.10; }
        50%      { opacity: 0.22; }
    }

    .ppl-chev {
        color: var(--text-tertiary);
        flex: none;
    }

    /* Deep-link flash from the credit-spend toast (#prof-plan-card is the plaque). */
    #prof-plan-card.prof-plan-flash {
        animation: prof-plan-flash 1.6s ease-out;
    }

    /* ── Plan sheet body (built by renderSheet) ─────────────────────────────── */
    .plan-cs .cs-scroll {
        padding-top: 8px;
        /* clearance for the floating "Сменить тариф" pinned at the bottom */
        padding-bottom: 78px;
        /* keep the wheel/touch scroll inside the sheet — never chain to the page */
        overscroll-behavior: contain;
    }

    .ps-hero {
        margin: 6px var(--card-inset, 18px) 0;
        padding: 15px 16px;
        background: linear-gradient(150deg, #ede9ff, #f3edf6 60%, #e9eefc);
        border: 1px solid rgba(108, 92, 231, 0.14);
        border-radius: 16px;
        display: flex;
        flex-direction: column;
        gap: 11px;
    }

    .ps-hero-top {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    .ps-cr {
        display: flex;
        align-items: baseline;
        gap: 8px;
    }

    .ps-cr .ppl-bolt {
        align-self: center;
    }

    .ps-cr strong {
        font-family: 'Space Grotesk', sans-serif;
        font-size: var(--font-xl);
        font-weight: 700;
        line-height: 1;
        letter-spacing: -0.02em;
        font-variant-numeric: tabular-nums;
        color: var(--text);
    }

    .ps-of {
        font-size: var(--font-xs);
        color: var(--text-secondary);
        align-self: flex-end;
        margin-bottom: 4px;
    }

    .ps-plan {
        font-size: 12.5px;
        font-weight: 700;
        color: var(--accent);
        white-space: nowrap;
    }

    /* Spend breakdown — rows with a background fill = share of spend, tinted per action.
       (.ps-bd itself is styled further below, next to the plan-sheet block rules.) */
    .ps-bd-row {
        position: relative;
        overflow: hidden;
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 12px;
        border-radius: 11px;
        background: rgba(17, 21, 34, 0.03);
        margin-top: 7px;
    }

    .ps-bd-row:first-child {
        margin-top: 2px;
    }

    .ps-bd-fill {
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        opacity: 0.16;
    }

    .ps-bd-i {
        position: relative;
        width: 18px;
        text-align: center;
    }

    .ps-bd-l {
        position: relative;
        flex: 1;
        min-width: 0;
        font-size: 12.5px;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .ps-bd-c {
        position: relative;
        font-family: 'Space Grotesk', sans-serif;
        font-weight: 700;
        font-variant-numeric: tabular-nums;
    }

    .ps-bd-s {
        position: relative;
        font-size: var(--font-xs);
        color: var(--text-secondary);
        min-width: 34px;
        text-align: right;
        font-weight: 600;
    }

    /* Floating "Сменить тариф" — sits over the scrolling content (no solid bar/field). */
    .ps-foot {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        padding: 10px var(--card-inset, 18px) calc(14px + env(safe-area-inset-bottom, 0px));
        pointer-events: none;
    }

    .ps-cta {
        pointer-events: auto;
        width: 100%;
        height: 48px;
        border: 0;
        border-radius: 14px;
        background: var(--accent);
        color: #fff;
        font-family: inherit;
        font-weight: 700;
        font-size: 14.5px;
        cursor: pointer;
        box-shadow: 0 10px 28px rgba(108, 92, 231, 0.32);
        transition: background 0.15s;
    }

    /* Plaque right column — plan · price · next-charge date, one line. */
    .ppl-r {
        display: flex;
        align-items: baseline;
        gap: 5px;
        flex: none;
    }

    .ppl-price {
        font-size: 13px;
        font-weight: 600;
        color: var(--text-secondary);
        white-space: nowrap;
    }

    .ppl-price::before,
    .ppl-date::before {
        content: '· ';
        color: var(--text-tertiary);
        font-weight: 500;
    }

    .ppl-date {
        font-size: 12px;
        color: var(--text-tertiary);
        font-weight: 600;
        white-space: nowrap;
    }

    .ppl-date[hidden] {
        display: none;
    }

    /* Desktop: the shared card-sheet already centers (base .modal-overlay) at
       max-width 440 — the plan sheet only overrides the shell height.
       Media-guarded so it doesn't beat the mobile bottom-sheet's 92dvh. */
    @media (min-width: 721px) {
        #plan-sheet .card-sheet {
            /* Static size — the shell never resizes; only .cs-scroll scrolls inside. */
            height: min(680px, 86vh);
        }
    }

    /* No focus ring on the collapsible block headers (they're tap toggles). */
    .plan-cs .cs-blk-h {
        outline: none;
        -webkit-tap-highlight-color: transparent;
    }

    .plan-cs .cs-blk-h:focus,
    .plan-cs .cs-blk-h:focus-visible {
        outline: none;
        box-shadow: none;
    }

    /* Spend rows live inside a .cs-blk-pad (14px inset) — drop own horizontal
       padding; a hairline separates the "Потрачено" attribute row above. */
    .ps-bd {
        padding: 8px 0 2px;
        margin-top: 2px;
        border-top: 1px solid rgba(0, 0, 0, 0.06);
    }

    /* Unused features (zero spend) — dimmed. */
    .ps-bd-row.is-zero {
        opacity: 0.45;
    }
}
