/*
    Account area — Profile and Subscription.

    One stylesheet for both pages so /profile, /subscription and /integrations
    read as a single family: warm cream surfaces, stone-ramp borders, ink text,
    DM Sans. Tokens (--stone-*, --ink-*, --amber-*, --surface-*) come from
    timeline.css :root, which both pages link alongside this file.

    The `acct-` prefix is deliberately page-neutral (unlike `plan-` / `someday-`
    / `integrations-`) because two routes share it. Some primitives here —
    banner, status pill, skeleton — mirror their integrations.css counterparts
    rather than importing them: the two files stay independently loadable, and
    a page only ever pulls the one it needs.

    Structure:
      1.  Primitives      — page shell, a11y helpers, motion
      2.  Header          — eyebrow, title, subtitle
      3.  Banner          — save / checkout feedback
      4.  Cards           — surface, head, eyebrow, divider
      5.  Fields          — grid, labels, help text, Mud input skins
      6.  Identity        — avatar, name preview
      7.  Heads-up        — preset chips, slider, preview
      8.  Quiet hours     — 24-hour band
      9.  Save bar        — sticky unsaved-changes bar
     10.  Plan            — status pill, plan card, meta rows
     11.  Buttons         — MudBlazor skins
     12.  Skeletons       — loading state
     13.  Responsive      — tablet + phone
*/

/* ═══ 1. Primitives ═══════════════════════════════════════════════ */

.acct-page {
    /* One value for the whole vertical stack, so the page and the form nested
       inside it (below) can never drift apart at a breakpoint. */
    --acct-stack-gap: 1.25rem;

    display: flex;
    flex-direction: column;
    gap: var(--acct-stack-gap);
    padding: 1.75rem 1.25rem 3rem;
    max-width: 820px;
    margin: 0 auto;
    color: var(--ink-primary);
    font-family: 'DM Sans', system-ui, sans-serif;
}

/* EditForm renders a plain <form>: a block box with no gap of its own. On Profile
   every card lives inside it, so the page's flex gap only ever applied to the
   form as a single child — spacing the plan strip above it, and nothing between
   the cards within. That is why Plan/You had air and no other pair did. Giving
   the form the same column layout puts its children back in the page's stack.

   Direct child only: the security page keeps two hidden POST forms nested in a
   wrapper, and they must stay laid out as they are. */
.acct-page > form {
    display: flex;
    flex-direction: column;
    gap: var(--acct-stack-gap);
}

.acct-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.acct-eyebrow {
    margin: 0;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.acct-sep {
    width: 3px;
    height: 3px;
    border-radius: 999px;
    background: var(--stone-300);
    flex: 0 0 auto;
}

@keyframes acct-shimmer {
    0%   { opacity: 0.55; }
    50%  { opacity: 0.9; }
    100% { opacity: 0.55; }
}

@keyframes acct-reveal {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: none; }
}

@keyframes acct-rise {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}

/* `.sec-dialog` is named alongside `.acct-page` because MudDialogProvider renders
   at the app root — every dialog on the account page sits OUTSIDE .acct-page and
   would otherwise miss this guard entirely. */
@media (prefers-reduced-motion: reduce) {
    .acct-page *,
    .sec-dialog * {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

/* ═══ 2. Header ═══════════════════════════════════════════════════ */

.acct-header {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0 0.15rem;
}

.acct-title {
    margin: 0;
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--ink-primary);
}

.acct-subtitle {
    margin: 0.1rem 0 0;
    font-size: 0.93rem;
    line-height: 1.55;
    color: var(--ink-muted);
    max-width: 42rem;
}

/* ═══ 3. Banner ═══════════════════════════════════════════════════ */

.acct-banner-slot:empty { display: none; }

.acct-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    border-radius: 12px;
    padding: 0.8rem 0.85rem 0.8rem 0.9rem;
    font-size: 0.9rem;
    line-height: 1.5;
    border: 1px solid var(--stone-200);
    background: rgba(245, 240, 232, 0.7);
    color: var(--ink-primary);
    animation: acct-reveal 160ms ease-out;
}

.acct-banner.is-success {
    border-color: rgba(74, 62, 46, 0.22);
    background: rgba(200, 180, 148, 0.2);
}

.acct-banner.is-error {
    border-color: rgba(160, 84, 74, 0.32);
    background: rgba(160, 84, 74, 0.08);
    color: #6e2e26;
}

.acct-banner-icon {
    flex: 0 0 auto;
    display: inline-flex;
    margin-top: 0.06rem;
}

.acct-banner-icon svg {
    width: 1.15rem;
    height: 1.15rem;
}

.acct-banner.is-success .acct-banner-icon { color: var(--stone-600); }
.acct-banner.is-error   .acct-banner-icon { color: #a0544a; }

.acct-banner-msg {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
}

.acct-banner-close {
    appearance: none;
    border: none;
    background: transparent;
    color: currentColor;
    opacity: 0.55;
    cursor: pointer;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    margin: -0.15rem -0.15rem 0 0;
    border-radius: 8px;
    transition: background 120ms ease, opacity 120ms ease;
}

.acct-banner-close svg { width: 0.95rem; height: 0.95rem; }

.acct-banner-close:hover {
    background: rgba(44, 44, 42, 0.07);
    opacity: 1;
}

.acct-banner-close:focus-visible {
    outline: 2px solid var(--stone-500);
    outline-offset: 1px;
    opacity: 1;
}

/* ═══ 4. Cards ════════════════════════════════════════════════════ */

.acct-card {
    background: var(--surface-base);
    border: 1px solid var(--stone-200);
    border-radius: 16px;
    padding: 1.15rem 1.25rem 1.25rem;
    box-shadow:
        0 4px 14px rgba(74, 62, 46, 0.05),
        0 1px 2px rgba(40, 25, 18, 0.04);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.acct-card-head {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.acct-card-title {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--ink-primary);
    line-height: 1.3;
}

.acct-card-help {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.55;
    color: var(--ink-muted);
    max-width: 44rem;
}

.acct-divider {
    border: none;
    border-top: 1px solid var(--stone-100);
    margin: 0.15rem 0 0;
}

/* ═══ 5. Fields ═══════════════════════════════════════════════════ */

.acct-field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: 0.9rem;
    align-items: start;
}

.acct-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.acct-field-label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--ink-muted);
}

/* Quieter by size only, like .bill-meta and .bill-note-quiet. Every note this
   class carries is information the reader needs before acting: what a password
   has to be, why it is asked for, and on the close-account dialog that the
   download holds sign-in details only and the tasks cannot be recovered. So it
   cannot sit in --ink-faint (about 3.3:1 on the paper surface). */
.acct-field-note {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--ink-muted);
}

/* Inline "what this resolves to right now" readouts under a control. Warm
   fill so they read as a computed echo of the input, not another input. */
.acct-echo {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    align-self: flex-start;
    padding: 0.35rem 0.65rem;
    border-radius: 9px;
    background: rgba(237, 229, 214, 0.7);
    border: 1px solid var(--stone-200);
    font-size: 0.82rem;
    color: var(--ink-muted);
    line-height: 1.4;
}

.acct-echo strong {
    color: var(--ink-primary);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.acct-echo-icon { display: inline-flex; color: var(--ink-faint); }
.acct-echo-icon svg { width: 0.95rem; height: 0.95rem; }

/* Time-zone autocomplete rows: id under the friendly label. */
.acct-tz-option { display: flex; flex-direction: column; gap: 0.05rem; }
.acct-tz-option-name { font-size: 0.9rem; color: var(--ink-primary); }
.acct-tz-option-id { font-size: 0.74rem; color: var(--ink-faint); }

/* ═══ 6. Identity ═════════════════════════════════════════════════ */

.acct-identity {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.acct-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.25rem;
    height: 3.25rem;
    flex: 0 0 auto;
    border-radius: 999px;
    background: var(--stone-400);
    color: var(--surface-base);
    border: 1px solid var(--stone-500);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    user-select: none;
}

.acct-identity-copy {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.acct-identity-name {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--ink-primary);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.acct-identity-name.is-empty {
    color: var(--ink-faint);
    font-weight: 500;
    font-style: italic;
}

.acct-identity-email {
    margin: 0;
    font-size: 0.83rem;
    color: var(--ink-muted);
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ═══ 7. Heads-up ═════════════════════════════════════════════════ */

.acct-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.acct-preset {
    appearance: none;
    font-family: inherit;
    cursor: pointer;
    padding: 0.32rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--stone-200);
    background: rgba(245, 240, 232, 0.55);
    color: var(--ink-muted);
    font-size: 0.82rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}

.acct-preset:hover {
    border-color: var(--stone-400);
    background: var(--stone-100);
    color: var(--ink-primary);
}

.acct-preset:focus-visible {
    outline: 2px solid var(--stone-500);
    outline-offset: 2px;
}

.acct-preset.is-active {
    background: var(--stone-400);
    border-color: var(--stone-500);
    color: var(--surface-base);
}

.acct-slider-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* A native range input (see Profile.razor for why it isn't MudSlider). WebKit,
   Chromium and Firefox each need their own track and thumb rules; the filled
   part of the track comes from --acct-slider-fill, which the page sets. The
   input is 28px tall so a finger gets a usable target around a 4px track. */
.acct-slider {
    --acct-slider-fill: 0%;
    --acct-slider-track: rgba(138, 118, 89, 0.3); /* --stone-500 at 30% */
    flex: 1 1 auto;
    min-width: 0;
    height: 28px;
    margin: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
}

.acct-slider:focus {
    outline: none;
}

.acct-slider::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 999px;
    background: linear-gradient(to right,
        var(--stone-500) 0 var(--acct-slider-fill),
        var(--acct-slider-track) var(--acct-slider-fill) 100%);
}

.acct-slider::-moz-range-track {
    height: 4px;
    border-radius: 999px;
    background: var(--acct-slider-track);
}

.acct-slider::-moz-range-progress {
    height: 4px;
    border-radius: 999px;
    background: var(--stone-500);
}

.acct-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    margin-top: -7px; /* centres the thumb on the 4px track */
    border: 2px solid var(--surface-base);
    border-radius: 50%;
    background: var(--stone-500);
    box-shadow: 0 1px 3px rgba(44, 44, 42, 0.3);
    transition: box-shadow 150ms ease;
}

.acct-slider::-moz-range-thumb {
    box-sizing: border-box;
    width: 18px;
    height: 18px;
    border: 2px solid var(--surface-base);
    border-radius: 50%;
    background: var(--stone-500);
    box-shadow: 0 1px 3px rgba(44, 44, 42, 0.3);
    transition: box-shadow 150ms ease;
}

.acct-slider:focus-visible::-webkit-slider-thumb,
.acct-slider:active::-webkit-slider-thumb {
    box-shadow: 0 1px 3px rgba(44, 44, 42, 0.3), 0 0 0 5px rgba(138, 118, 89, 0.24);
}

.acct-slider:focus-visible::-moz-range-thumb,
.acct-slider:active::-moz-range-thumb {
    box-shadow: 0 1px 3px rgba(44, 44, 42, 0.3), 0 0 0 5px rgba(138, 118, 89, 0.24);
}

.acct-slider-value {
    flex: 0 0 auto;
    min-width: 4.75rem;
    text-align: right;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--ink-primary);
    font-variant-numeric: tabular-nums;
}

/* ═══ 8. Quiet hours ══════════════════════════════════════════════ */

.acct-quiet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.acct-quiet-state {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ink-muted);
    font-variant-numeric: tabular-nums;
}

/* A 24-hour strip with the silent window drawn on it. A wrapping window
   (22:00 → 07:00) is two segments, which is exactly the thing two time
   inputs alone can't communicate. */
.acct-band-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.acct-band {
    position: relative;
    height: 1.6rem;
    border-radius: 8px;
    background: var(--stone-100);
    border: 1px solid var(--stone-200);
    overflow: hidden;
}

.acct-band-seg {
    position: absolute;
    top: 0;
    bottom: 0;
    background: var(--stone-400);
    transition: left 160ms ease, width 160ms ease;
}

.acct-band.is-off .acct-band-seg {
    background: var(--stone-300);
    opacity: 0.4;
}

.acct-band-noon {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
    background: rgba(44, 44, 42, 0.12);
}

.acct-band-ticks {
    display: flex;
    justify-content: space-between;
    font-size: 0.66rem;
    color: var(--ink-faint);
    font-variant-numeric: tabular-nums;
}

.acct-times {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: 0.75rem;
}

.acct-warning {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.65rem 0.8rem;
    border-radius: 11px;
    border: 1px solid rgba(200, 152, 72, 0.45);
    background: rgba(200, 152, 72, 0.13);
    font-size: 0.84rem;
    line-height: 1.5;
    color: var(--ink-muted);
}

.acct-warning-icon { flex: 0 0 auto; display: inline-flex; color: var(--amber-600); margin-top: 0.06rem; }
.acct-warning-icon svg { width: 1.05rem; height: 1.05rem; }
.acct-warning p { margin: 0; }
.acct-warning strong { color: var(--ink-primary); }

/* ═══ 9. Save bar ═════════════════════════════════════════════════ */

/* Only appears once something is actually dirty, and rides the bottom of the
   viewport so a change made at the top of a long form is still one click from
   being saved. Falls back to a plain in-flow row if a scroll ancestor ever
   makes `sticky` inert. */
.acct-savebar {
    position: sticky;
    bottom: 0.85rem;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
    margin-top: 0.25rem;
    padding: 0.7rem 0.75rem 0.7rem 1rem;
    border-radius: 14px;
    border: 1px solid var(--stone-300);
    background: var(--surface-muted);
    box-shadow:
        0 8px 24px rgba(74, 62, 46, 0.14),
        0 2px 6px rgba(40, 25, 18, 0.08);
    animation: acct-rise 160ms ease-out;
}

.acct-savebar-msg {
    flex: 1 1 auto;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--ink-primary);
}

.acct-savebar-dot {
    width: 0.45rem;
    height: 0.45rem;
    flex: 0 0 auto;
    border-radius: 999px;
    background: var(--amber-400);
}

.acct-savebar-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex: 0 0 auto;
}

/* ═══ 10. Plan ════════════════════════════════════════════════════ */

.acct-status {
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
    padding: 0.22rem 0.6rem 0.22rem 0.5rem;
    border-radius: 999px;
    font-size: 0.69rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
    border: 1px solid transparent;
}

.acct-status-dot {
    width: 0.42rem;
    height: 0.42rem;
    border-radius: 999px;
    background: currentColor;
    flex: 0 0 auto;
}

.acct-status-active {
    background: rgba(74, 62, 46, 0.09);
    border-color: rgba(74, 62, 46, 0.16);
    color: var(--stone-700);
}

.acct-status-attention {
    background: rgba(200, 152, 72, 0.2);
    border-color: rgba(200, 152, 72, 0.42);
    color: var(--amber-600);
}

.acct-status-inactive {
    background: var(--stone-100);
    border-color: var(--stone-200);
    color: var(--ink-faint);
}

.acct-status-problem {
    background: rgba(160, 84, 74, 0.1);
    border-color: rgba(160, 84, 74, 0.32);
    color: #8a3e34;
}

/* — Plan summary strip (Profile) — */

.acct-planstrip {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.7rem 0.85rem 0.7rem 0.75rem;
    border-radius: 13px;
    border: 1px solid var(--stone-200);
    background: rgba(245, 240, 232, 0.55);
    color: inherit;
    text-decoration: none;
    transition: border-color 130ms ease, background 130ms ease;
}

a.acct-planstrip:hover {
    border-color: var(--stone-400);
    background: var(--stone-100);
}

a.acct-planstrip:focus-visible {
    outline: 2px solid var(--stone-500);
    outline-offset: 2px;
}

.acct-planstrip-copy {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.2rem 0.5rem;
    flex: 1 1 auto;
    min-width: 0;
}

.acct-planstrip-label {
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--ink-faint);
    flex: 0 0 100%;
}

.acct-planstrip-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--ink-primary);
}

.acct-planstrip-detail {
    font-size: 0.83rem;
    color: var(--ink-muted);
}

.acct-planstrip-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    flex: 0 0 auto;
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--ink-muted);
}

.acct-planstrip-cta svg {
    width: 0.85rem;
    height: 0.85rem;
    transition: transform 130ms ease;
}

/* Optional leading slot so the strip can carry an .acct-avatar circle (the
   "Signed in as" row on /Account/Manage). /profile's plan strip omits it. */
.acct-planstrip-avatar {
    flex: 0 0 auto;
    width: 2.25rem;
    height: 2.25rem;
    font-size: 0.9rem;
}

/* Only the avatar-bearing variant carries an email address in the name slot, and a
   long unbroken address would otherwise push the CTA off the strip. Scoped to that
   variant so /profile's short plan names keep their current sizing. */
.acct-planstrip-avatar ~ .acct-planstrip-copy .acct-planstrip-name,
.acct-planstrip-avatar ~ .acct-planstrip-copy .acct-planstrip-detail {
    overflow-wrap: anywhere;
}

a.acct-planstrip:hover .acct-planstrip-cta { color: var(--ink-primary); }
a.acct-planstrip:hover .acct-planstrip-cta svg { transform: translateX(2px); }

/* — Plan card (Subscription) — */

.acct-plan-head {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
}

.acct-plan-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    flex: 0 0 auto;
    border-radius: 11px;
    background: var(--stone-100);
    border: 1px solid var(--stone-200);
    color: var(--ink-primary);
}

.acct-plan-copy {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.acct-plan-name {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.2;
    color: var(--ink-primary);
}

.acct-plan-detail {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--ink-muted);
}

.acct-plan-foot {
    margin: 0;
    font-size: 0.8rem;
    color: var(--ink-faint);
}

/* Key/value rows — provider, renewal, enforcement. */
.acct-rows {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.acct-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 0;
    border-top: 1px solid var(--stone-100);
    font-size: 0.87rem;
}

.acct-row:first-child { border-top: none; }

.acct-row-key { color: var(--ink-muted); flex: 0 0 auto; }

.acct-row-val {
    color: var(--ink-primary);
    font-weight: 600;
    text-align: right;
    min-width: 0;
}

.acct-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.acct-actions-spacer { flex: 1 1 auto; }

.acct-note {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.7rem 0.8rem;
    border-radius: 11px;
    border: 1px solid var(--stone-200);
    background: rgba(237, 229, 214, 0.55);
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--ink-muted);
}

.acct-note.is-attention {
    border-color: rgba(200, 152, 72, 0.45);
    background: rgba(200, 152, 72, 0.13);
}

.acct-note.is-problem {
    border-color: rgba(160, 84, 74, 0.28);
    background: rgba(160, 84, 74, 0.07);
}

.acct-note-icon { flex: 0 0 auto; display: inline-flex; margin-top: 0.06rem; color: var(--ink-faint); }
.acct-note-icon svg { width: 1.05rem; height: 1.05rem; }
.acct-note.is-attention .acct-note-icon { color: var(--amber-600); }
.acct-note.is-problem   .acct-note-icon { color: #a0544a; }
.acct-note p { margin: 0; }
.acct-note strong { color: var(--ink-primary); }

/* ═══ 11. Buttons (MudBlazor skins) ═══════════════════════════════ */

/* Same reason as the reduced-motion guard above: dialogs render at the provider
   root, so they need naming explicitly or they keep MudBlazor's all-caps shout. */
.acct-page .mud-button-root,
.sec-dialog .mud-button-root {
    text-transform: none !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
}

.acct-btn-primary.mud-button-filled {
    color: var(--surface-base) !important;
}

.acct-btn-outlined.mud-button-outlined {
    border: 1px solid var(--stone-300) !important;
    color: var(--ink-primary) !important;
    background: transparent !important;
}

.acct-btn-outlined.mud-button-outlined:hover:not(:disabled) {
    background: var(--stone-100) !important;
    border-color: var(--stone-500) !important;
}

.acct-btn-quiet.mud-button-root {
    color: var(--ink-muted) !important;
}

.acct-btn-quiet.mud-button-root:hover:not(:disabled) {
    background: rgba(44, 44, 42, 0.05) !important;
    color: var(--ink-primary) !important;
}

/* Switch: the label is our own markup, so this only needs to sit flush and
   show a keyboard focus ring. The thumb class carries a size suffix. */
.acct-switch { margin: 0 !important; }

.acct-switch:focus-within [class*="mud-switch-thumb"] {
    box-shadow: 0 0 0 3px rgba(138, 118, 89, 0.32);
}

/* ═══ 12. Skeletons ═══════════════════════════════════════════════ */

.acct-skel {
    display: block;
    background: var(--stone-100);
    border-radius: 7px;
    animation: acct-shimmer 1.4s ease-in-out infinite;
}

.acct-skel-line { height: 0.85rem; }
.acct-skel-line.is-sm { height: 0.65rem; }
.acct-skel-row { height: 2.6rem; border-radius: 10px; }

.acct-skel-avatar {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 999px;
    flex: 0 0 auto;
}

.acct-skel-head {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.acct-skel-stack {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1 1 auto;
    min-width: 0;
}

.acct-card.is-skeleton { pointer-events: none; }

/* ═══ 13. Responsive ══════════════════════════════════════════════ */

/* The two field grids need no breakpoint of their own — their auto-fit
   minmax() already collapses to one column once the card gets narrow. */

@media (max-width: 600px) {
    .acct-page {
        padding: 1.15rem 0.85rem 2.5rem;
        /* The custom property, not `gap` directly — the nested form reads this
           too, and setting gap here would tighten the page while leaving the
           cards inside the form at the desktop spacing. */
        --acct-stack-gap: 1rem;
    }

    .acct-title { font-size: 1.55rem; }

    .acct-card {
        padding: 0.95rem 0.9rem 1rem;
        border-radius: 14px;
    }

    .acct-slider-row {
        gap: 0.75rem;
    }

    .acct-savebar {
        bottom: 0.6rem;
        padding: 0.7rem 0.75rem;
    }
}

/* Below this the save-bar message and its buttons stop fitting on one line,
   and a key…value row is better read stacked than squeezed. */
@media (max-width: 520px) {
    .acct-savebar-actions {
        flex: 1 1 100%;
    }

    .acct-savebar-actions .mud-button-root,
    .acct-actions .mud-button-root {
        flex: 1 1 auto;
    }

    .acct-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.15rem;
    }

    .acct-row-val { text-align: left; }
}

/* Lift the sticky save bar clear of the mobile bottom tab bar when the host
   shell renders one (mirrors the .hf-has-bottom-tabs rule in timeline.css). */
.hf-has-bottom-tabs .acct-savebar {
    bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px));
}

/* ==========================================================================
   14. Billing page — bill-*
   Redesign of /subscription. The page answers one question first: what am I
   about to be charged, and when. Everything else is secondary, so the hero is
   a sentence rather than a table of label/value rows.
   Reuses .acct-page, .acct-header and .acct-status from the sections above.
   ========================================================================== */

.bill-card {
  background: var(--surface-base);
  border: 1px solid var(--stone-200);
  border-radius: 16px;
  padding: 1.35rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  box-shadow:
    0 4px 14px rgba(74, 62, 46, 0.05),
    0 1px 2px rgba(40, 25, 18, 0.04);
}

.bill-card-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem 0.8rem;
}

.bill-plan-line {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

/* The largest type on the page, deliberately. */
.bill-headline {
  margin: 0.15rem 0 0;
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.015em;
  color: var(--ink-primary);
  font-variant-numeric: tabular-nums;
}

.bill-consequence {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--ink-muted);
  max-width: 38rem;
}

/* Quieter by size only, like .bill-note-quiet below: "Billed through …" tells the
   reader who charges them, and for a Stripe subscription it is the only line that
   says so, so it cannot sit in --ink-faint (about 3.3:1 on the card). */
.bill-meta {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.bill-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.5rem;
}

.bill-actions-spacer {
  flex: 1 1 auto;
}

/* Buttons are raw <button>, not MudButton: this page needs a danger variant and
   a link-shaped variant that the .acct-btn-* skins do not cover, and app.css
   forces every Mud button flat anyway. */
.bill-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--stone-300);
  border-radius: 10px;
  background: transparent;
  color: var(--ink-primary);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease;
}

.bill-btn:hover:not(:disabled) {
  background: var(--stone-100);
  border-color: var(--stone-500);
}

.bill-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.bill-btn:focus-visible {
  outline: 2px solid var(--stone-500);
  outline-offset: 2px;
}

.bill-btn-primary {
  background: var(--stone-500);
  border-color: var(--stone-500);
  color: var(--surface-base);
}

.bill-btn-primary:hover:not(:disabled) {
  background: var(--stone-600);
  border-color: var(--stone-600);
}

.bill-btn-quiet {
  border-color: transparent;
  color: var(--ink-muted);
  font-weight: 500;
}

.bill-btn-quiet:hover:not(:disabled) {
  background: rgba(44, 44, 42, 0.05);
  border-color: transparent;
}

/* Red is reserved for the destructive confirm, never for a failed payment. */
.bill-btn-danger {
  border-color: rgba(160, 84, 74, 0.45);
  color: #8a3e34;
}

.bill-btn-danger:hover:not(:disabled) {
  background: rgba(160, 84, 74, 0.08);
  border-color: #8a3e34;
}

/* --- Alerts ------------------------------------------------------------- */

.bill-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--stone-200);
  background: var(--stone-50);
}

.bill-alert > div {
  flex: 1 1 auto;
}

.bill-alert-title {
  margin: 0 0 0.15rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink-primary);
}

.bill-alert-msg {
  margin: 0;
  flex: 1 1 auto;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--ink-muted);
}

/* Amber for "needs attention" — an expired card is not a moral failing, and a
   red accusatory banner pushes people toward cancelling rather than fixing. */
.bill-alert.is-attention {
  border-color: rgba(200, 152, 72, 0.45);
  background: rgba(200, 152, 72, 0.12);
}

.bill-alert.is-attention .bill-alert-msg {
  color: var(--stone-700);
}

.bill-alert.is-problem {
  border-color: rgba(160, 84, 74, 0.35);
  background: rgba(160, 84, 74, 0.10);
}

.bill-alert.is-problem .bill-alert-msg {
  color: #8a3e34;
}

.bill-alert.is-good {
  border-color: rgba(74, 62, 46, 0.2);
  background: rgba(74, 62, 46, 0.06);
}

.bill-alert-close {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0.15rem;
  border-radius: 6px;
  line-height: 0;
}

.bill-alert-close svg {
  width: 1rem;
  height: 1rem;
}

/* --- Store-billed note --------------------------------------------------- */

.bill-note {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 1.1rem 1.25rem;
  border-radius: 14px;
  border: 1px solid var(--stone-200);
  background: var(--stone-50);
}

.bill-note p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--ink-muted);
  max-width: 42rem;
}

.bill-note-title {
  font-size: 0.95rem !important;
  font-weight: 700;
  color: var(--ink-primary) !important;
}

/* Quieter by size only. This paragraph says where receipts live and where to ask
   for a refund — the one place an App Store subscriber learns that — so it cannot
   sit in --ink-faint, which measures about 3.3:1 on the --stone-50 note and misses
   the 4.5:1 AA floor for this 0.83rem text. */
.bill-note-quiet {
  font-size: 0.83rem !important;
  color: var(--ink-muted) !important;
}

/* --- Cancel -------------------------------------------------------------- */

/* Deliberately a visible control on the page, not inside a collapsed "danger
   zone" and never "contact us to cancel". Quiet, but present. */
.bill-cancel {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8rem;
  padding: 1.1rem 1.25rem;
  border-radius: 14px;
  border: 1px dashed var(--stone-200);
}

.bill-cancel > div {
  flex: 1 1 16rem;
}

.bill-cancel-title {
  margin: 0 0 0.15rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink-primary);
}

.bill-cancel-copy {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--ink-faint);
  max-width: 38rem;
}

@media (max-width: 560px) {
  .bill-actions .bill-btn {
    flex: 1 1 auto;
  }

  .bill-actions-spacer {
    display: none;
  }

  .bill-headline {
    font-size: 1.18rem;
  }
}

/* --- Invoices / receipts -------------------------------------------------- */

.bill-invoices {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.bill-section-title {
  margin: 0.4rem 0 0;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.bill-invoice-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--stone-200);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface-base);
}

/* Rows, not cards. A dense list is the right shape for a receipt history — one
   card per invoice turns twelve rows into a page of scrolling. */
.bill-invoice {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 0.9rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--stone-200);
}

.bill-invoice:last-child {
  border-bottom: 0;
}

.bill-invoice.is-skeleton {
  grid-template-columns: minmax(0, 1fr) auto;
}

.bill-invoice-main {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.bill-invoice-date {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-primary);
  font-variant-numeric: tabular-nums;
}

.bill-invoice-desc {
  font-size: 0.8rem;
  color: var(--ink-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bill-invoice-number {
  font-variant-numeric: tabular-nums;
}

.bill-invoice-amount {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-primary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bill-invoice-status {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  white-space: nowrap;
}

.bill-invoice-status.is-paid {
  background: rgba(74, 62, 46, 0.09);
  color: var(--stone-700);
}

.bill-invoice-status.is-pending {
  background: rgba(200, 152, 72, 0.2);
  color: var(--amber-600);
}

.bill-invoice-status.is-void {
  background: var(--stone-100);
  color: var(--ink-faint);
}

.bill-invoice-links {
  display: flex;
  gap: 0.6rem;
}

/* An accent link, deliberately amber rather than the default --stone-700: an invoice is the
   one thing on the billing page worth reaching for, and amber is the product's only secondary
   hue. This is a choice, not a workaround -- it used to be one, back when app.css painted
   every link MudBlazor violet. */
.bill-invoice-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--amber-600);
  text-decoration: none;
}

.bill-invoice-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.bill-invoice-link:focus-visible {
  outline: 2px solid var(--stone-500);
  outline-offset: 2px;
  border-radius: 3px;
}

.bill-invoice-empty {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0;
  padding: 0.9rem 1rem;
  border: 1px dashed var(--stone-200);
  border-radius: 14px;
  font-size: 0.87rem;
  color: var(--ink-faint);
}

.bill-load-more {
  align-self: flex-start;
}

/* Below this the four-column row cannot hold a description, so the status and
   links wrap under the date and amount instead of squeezing. */
@media (max-width: 560px) {
  .bill-invoice {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 0.45rem;
  }

  .bill-invoice-status {
    grid-column: 1;
    justify-self: start;
  }

  .bill-invoice-links {
    grid-column: 2;
    justify-self: end;
  }
}

/* ==========================================================================
   15. Account & security page — sec-*
   /Account/Manage. Replaces the scaffolded Identity "Manage" area: twelve
   pages behind a left-hand nav, collapsed into one page that reads as a
   sibling of /profile and /subscription.

   Reuses .acct-page, .acct-header, .acct-card, .acct-note, .acct-status,
   .acct-planstrip, .acct-banner and the .bill-btn* family wholesale — the
   classes below only cover shapes those don't already have.

   The rare, multi-step ceremonies (authenticator enrolment, recovery codes,
   every destructive confirm) run in MudDialogs, which render at the provider
   root OUTSIDE .acct-page. That is why the .sec-dialog* rules re-declare font
   and colour rather than inheriting them.
   ========================================================================== */

/* The two antiforgery form posts (download personal data, link an external
   login) live here, always rendered and never inside a dialog or an @if, so
   the visible buttons can reach them by form="..." from anywhere on the page. */
.sec-forms { display: none; }

/* --- Security checkup ---------------------------------------------------- */

.sec-checkup { gap: 0.85rem; }

/* Names the offender rather than showing a score — a percentage invites
   gaming and implies a precision we don't have. */
.sec-checkup-verdict {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.4;
  color: var(--ink-primary);
}

.sec-checkup-clear {
  margin: 0;
  font-size: 0.83rem;
  color: var(--ink-muted);
}

.sec-checks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}

/* Only checks that are NOT green render as rows, so the card never repeats a
   pill the section below it already owns. Tone is a 3px left rule rather than
   a glyph — an icon column is one more thing a 320px screen can't spare. */
.sec-check {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0 0.6rem 0.7rem;
  border-top: 1px solid var(--stone-100);
  border-left: 3px solid var(--sec-tone, transparent);
  border-top-left-radius: 3px;
}

.sec-check:first-child { border-top: none; }

.sec-check.is-problem   { --sec-tone: #a0544a; }
.sec-check.is-attention { --sec-tone: var(--amber-400); }
.sec-check.is-neutral   { --sec-tone: var(--stone-300); }

.sec-check-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.sec-check-name {
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--ink-primary);
}

.sec-check-detail {
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--ink-muted);
}

/* A <button> styled as a quiet inline action, so it needs its colour stated: MudBlazor resets
   buttons to inherit, and the default `a` colour never applied to a button in the first place.
   --stone-600 keeps it one step quieter than a real link. */
.sec-check-action {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--stone-600);
  white-space: nowrap;
}

.sec-check-action:hover {
  color: var(--ink-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.sec-check-action:focus-visible {
  outline: 2px solid var(--stone-500);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --- Method rows (two-step sub-controls, connected services) -------------- */

.sec-methods {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

/* Negative horizontal bleed so the hover fill reaches the card's padding edge
   instead of stopping short of it. */
.sec-method {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  min-height: 2.75rem;
  margin: 0 -0.5rem;
  padding: 0.55rem 0.5rem;
  border-radius: 9px;
  transition: background 130ms ease;
}

.sec-method:hover { background: rgba(237, 229, 214, 0.55); }

.sec-method-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.sec-method-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-primary);
}

.sec-method-meta {
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--ink-muted);
}

/* Darker than --amber-600, which measures 4.35:1 on the cream card surface and so
   misses the 4.5:1 AA floor for this 0.8rem text. The token is left alone because
   it is shared with .acct-status-attention across the app. */
.sec-method.is-attention .sec-method-meta { color: #7c5717; }
.sec-method.is-problem   .sec-method-meta { color: #8a3e34; }

/* --- Card furniture ------------------------------------------------------ */

.sec-body {
  margin: 0;
  font-size: 0.87rem;
  line-height: 1.5;
  color: var(--ink-muted);
  max-width: 44rem;
}

.sec-note-quiet {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.79rem;
  color: var(--ink-faint);
}

.sec-empty {
  margin: 0;
  padding: 0.85rem;
  border: 1px dashed var(--stone-300);
  border-radius: 14px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.sec-card-foot {
  border-top: 1px solid var(--stone-100);
  padding-top: 0.85rem;
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.sec-connect { justify-content: flex-start; }

/* --- Danger block -------------------------------------------------------- */

/* Deliberately NOT an .acct-card: closing the account must not look like the
   reversible settings stacked above it. Dashed and unfilled rather than red —
   a permanently red panel trains people to stop seeing red. */
.sec-danger {
  border: 1px dashed var(--stone-300);
  border-radius: 14px;
  padding: 1.15rem 1.25rem;
  background: transparent;
  box-shadow: none;
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.sec-danger-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink-primary);
}

.sec-danger-copy {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--ink-muted);
  max-width: 44rem;
}

.sec-danger-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* --- Deep-link flash ------------------------------------------------------ */

/* The eleven legacy /Account/Manage/* URLs still resolve; arriving on one
   scrolls to the owning section and pulses its border so the eye lands in the
   right place. Two short pulses, not a long glow. */
.is-flash { animation: sec-flash 300ms ease-out 2; }

@keyframes sec-flash {
  0%, 100% { border-color: var(--stone-200); }
  50%      { border-color: var(--stone-500); }
}

/* --- Dialogs ------------------------------------------------------------- */

.sec-dialog {
  font-family: 'DM Sans', system-ui, sans-serif;
  color: var(--ink-primary);
}

.sec-dialog-wide { min-width: min(30rem, 92vw); }

.sec-dialog-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.sec-dialog-lede {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--ink-muted);
}

.sec-dialog-body {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.sec-dialog-error {
  display: flex;
  gap: 0.6rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid rgba(160, 84, 74, 0.32);
  background: rgba(160, 84, 74, 0.07);
  border-radius: 11px;
  color: #6e2e26;
  font-size: 0.84rem;
  line-height: 1.5;
}

.sec-dialog-error svg { width: 1.05rem; height: 1.05rem; flex: 0 0 auto; }
.sec-dialog-error p { margin: 0; }

.sec-dialog-foot {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.sec-dialog-foot-spacer { flex: 1 1 auto; }

/* The theme's Color.Error is a Material red that reads as an alarm next to a
   warm-stone palette. This is the same rust the rest of the product uses for
   destructive edges (.bill-btn-danger, .integrations-btn-destructive). */
.sec-btn-danger.mud-button-filled {
  background: #a0544a !important;
  color: #fdf8f1 !important;
}

.sec-btn-danger.mud-button-filled:hover:not(:disabled) {
  background: #8a3e34 !important;
}

/* --- Authenticator enrolment --------------------------------------------- */

.sec-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1.05rem;
}

.sec-step {
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr);
  gap: 0.7rem;
  align-items: start;
}

.sec-step-num {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  background: var(--stone-100);
  border: 1px solid var(--stone-200);
  color: var(--stone-700);
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sec-step-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sec-step-body p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
}

/* Stone rather than white: QR readers cope fine with this contrast ratio and
   a white tile is the one thing on the page that would look pasted on. */
.sec-qr {
  align-self: flex-start;
  padding: 0.75rem;
  background: var(--stone-100);
  border: 1px solid var(--stone-200);
  border-radius: 11px;
}

.sec-qr img { display: block; width: 180px; height: 180px; }

.sec-key-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* overflow-wrap, never word-break: the key is rendered as space-separated
   four-character groups and a wrap must fall between groups, not inside one. */
.sec-key {
  padding: 0.4rem 0.6rem;
  background: var(--stone-100);
  border: 1px solid var(--stone-200);
  border-radius: 9px;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  user-select: all;
  overflow-wrap: anywhere;
}

/* --- Recovery codes ------------------------------------------------------- */

.sec-codes-panel {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.sec-codes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
}

.sec-code {
  display: block;
  padding: 0.4rem 0.5rem;
  text-align: center;
  background: var(--stone-100);
  border: 1px solid var(--stone-200);
  border-radius: 9px;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  user-select: all;
}

.sec-codes-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* The acknowledgement is the ONLY control that dismisses the codes — these are
   shown exactly once and cannot be recovered afterwards. */
.sec-ack {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--stone-200);
  padding-top: 0.75rem;
}

.sec-ack-box {
  flex: 1 1 auto;
  font-size: 0.85rem;
}

.sec-ack-box [class*="mud-checkbox"] { color: var(--stone-500); }

/* ==========================================================================
   16. Confirmation bullets — acct-confirm-*
   The consequence list every destructive dialog shows before it commits.
   Neutral prefix because /integrations ships the same shape under
   `integrations-confirm-*`; that page adopts these in a later pass.
   ========================================================================== */

.acct-confirm-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.acct-confirm-bullet {
  position: relative;
  padding-left: 1.05rem;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--ink-muted);
}

.acct-confirm-bullet::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 999px;
  background: currentColor;
}

.acct-confirm-bullet.is-remove { color: #a0544a; }
.acct-confirm-bullet.is-safe   { color: var(--stone-600); }

/* Amber marks the dot only. As text, --amber-600 measures about 4.35:1 on the
   web dialog's #F5F2E8 surface and misses the 4.5:1 AA floor for this 0.85rem
   text, and these lines are what closing keeps (invoices, billing details, the
   clinic entry) — read before an irreversible step — so the words stay on the
   base rule's --ink-muted. The dot still clears the 3:1 non-text floor. */
.acct-confirm-bullet.is-keep::before { background: var(--amber-600); }

/* --- Responsive additions for §15 ----------------------------------------- */

@media (max-width: 600px) {
  /* The action drops under the copy rather than squeezing a third column. */
  .sec-check {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 0.4rem;
  }

  .sec-check-action {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .sec-danger {
    padding: 0.95rem 0.9rem;
  }

  .sec-codes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  /* Below this a name + a control on one line starts truncating the name. */
  .sec-method {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 0.5rem;
  }

  /* The row is one column here, so anything in the trailing slot would otherwise
     stretch the full width of the card - a status pill most visibly. */
  .sec-method .bill-btn,
  .sec-method .mud-button-root,
  .sec-method > .acct-status {
    justify-self: start;
  }

  .sec-card-foot,
  .sec-danger-actions,
  .sec-codes-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .sec-dialog-foot {
    flex-wrap: wrap;
  }

  .sec-dialog-foot-spacer { display: none; }
}

/* ==========================================================================
   17. Linked devices and /link — acct-device-*, acct-code-*, acct-link-*
   Settings → Linked devices (Client.Shared/Pages/LinkedDevices.razor) and the
   device-code approval page (Pages/LinkDevice.razor). Both reuse .acct-page,
   .acct-header, .acct-card, .acct-banner, .acct-note, .acct-warning and the
   button skins; these rules cover only the device icon, the device rows,
   the "Get the apps" list, the code field and the consent screen.
   Informational text is --ink-muted throughout, never
   --ink-faint (fails AA), and a control's edge is --stone-500 or darker,
   never --stone-300 (fails the 3:1 of WCAG 1.4.11).
   ========================================================================== */

/* --- Header --------------------------------------------------------------- */

/* The shared .acct-eyebrow paints --ink-faint, about 3.3:1 on cream at this
   size. Both pages put .acct-device-eyebrow beside it to step the "Account"
   eyebrow to --ink-muted (about 5.3:1). Scoped, so the pages that already use
   the shared rule keep their look. */
.acct-eyebrow.acct-device-eyebrow { color: var(--ink-muted); }

/* --- Device icon (Components/Devices/LinkedDeviceIcon.razor) --------------- */

/* The platform's line glyph on a stone tile, like the calendar marks on
   Integrations. Always decorative: the platform label beside it is the text.
   is-small is the "Get the apps" list, is-large the /link consent screen. */
.acct-device-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 12px;
    border: 1px solid var(--stone-200);
    background: linear-gradient(180deg, var(--stone-50), var(--stone-100));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
    color: var(--stone-700);
}

.acct-device-icon svg {
    display: block;
    width: 1.5rem;
    height: 1.5rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.acct-device-icon .is-fill {
    fill: currentColor;
    stroke: none;
}

.acct-device-icon.is-small {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 10px;
}

.acct-device-icon.is-small svg { width: 1.25rem; height: 1.25rem; }

.acct-device-icon.is-large {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 14px;
}

.acct-device-icon.is-large svg { width: 1.8rem; height: 1.8rem; }

/* --- Device list ---------------------------------------------------------- */

/* "Your devices" carries the count once the list has loaded (aria-hidden:
   the list itself tells assistive tech how many). */
.acct-device-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.35rem;
    margin-inline-start: 0.4rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    border: 1px solid var(--stone-200);
    background: var(--stone-100);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0;
    color: var(--ink-muted);
    font-variant-numeric: tabular-nums;
    vertical-align: 0.1em;
}

/* A row is the icon, the name and its details, then Unlink; at 520px and
   below Unlink drops under the details, lined up with the name, instead of
   squeezing it. */
.acct-device {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.65rem 0.9rem;
    padding: 0.85rem 0;
    border-top: 1px solid var(--stone-100);
}

.acct-device:first-child {
    border-top: none;
    padding-top: 0.1rem;
}

.acct-device:last-child { padding-bottom: 0; }

.acct-device-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

/* The device chose this name: it wraps, whatever its length, and is never
   ellipsised (the server caps it at 40 characters anyway). */
.acct-device-name {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--ink-primary);
    overflow-wrap: anywhere;
}

/* Platform · Last used · Linked, wrapping as whole items. Each item draws the
   dot before it; the line is pulled left by one dot's width and that strip is
   clipped, so the dot of whichever item starts a line is never seen and no
   line begins or ends with a stray separator. */
.acct-device-meta {
    --acct-device-sep: calc(1rem + 3px);
    margin: 0 0 0 calc(-1 * var(--acct-device-sep));
    clip-path: inset(0 0 0 var(--acct-device-sep));
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--ink-muted);
}

.acct-device-meta > span { white-space: nowrap; }

.acct-device-meta > span::before {
    content: "";
    display: inline-block;
    width: 3px;
    height: 3px;
    margin: 0 0.5rem;
    border-radius: 999px;
    background: var(--stone-300);
    vertical-align: middle;
}

/* Nothing linked: the three platforms as a small overlapping cluster in a
   dashed well, so the empty card has a focal point and says what can go
   here. The ring matches the well, so each tile reads as cut out of the
   one behind it. */
.acct-device-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 1.5rem 1rem 1.6rem;
    border: 1px dashed var(--stone-300);
    border-radius: 14px;
    background: var(--stone-50);
    text-align: center;
}

.acct-device-empty-marks {
    display: flex;
    align-items: center;
    margin-bottom: 0.6rem;
}

.acct-device-empty-marks .acct-device-icon {
    box-shadow:
        0 0 0 3px var(--stone-50),
        0 3px 8px rgba(74, 62, 46, 0.1);
}

.acct-device-empty-marks .acct-device-icon + .acct-device-icon { margin-left: -0.5rem; }
.acct-device-empty-marks .acct-device-icon:nth-child(1) { transform: rotate(-8deg) translateY(3px); }
.acct-device-empty-marks .acct-device-icon:nth-child(2) { position: relative; z-index: 1; }
.acct-device-empty-marks .acct-device-icon:nth-child(3) { transform: rotate(8deg) translateY(3px); }

.acct-device-empty-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.35;
    color: var(--ink-primary);
}

.acct-device-empty-copy {
    margin: 0;
    max-width: 30rem;
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--ink-muted);
}

/* Loading: two rows in the shape of the real ones. */
.acct-device-skeleton {
    display: flex;
    flex-direction: column;
}

.acct-device-skel {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.9rem;
    padding: 0.85rem 0;
    border-top: 1px solid var(--stone-100);
}

.acct-device-skel:first-child {
    border-top: none;
    padding-top: 0.1rem;
}

.acct-device-skel:last-child { padding-bottom: 0; }

.acct-device-skel-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 12px;
}

.acct-device-skel .acct-skel-line { width: min(10rem, 75%); }
.acct-device-skel .acct-skel-line.is-sm { width: min(16rem, 100%); }

.acct-device-skel-button {
    width: 4.75rem;
    height: 2.3rem;
    border-radius: 10px;
}

/* --- Get the apps --------------------------------------------------------- */

/* Each platform and the store it comes from. Plain items, not tiles: none of
   them is a link, so nothing here may look pressable. */
.acct-device-apps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: 0.75rem 1rem;
}

.acct-device-app {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
}

.acct-device-app-copy {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    min-width: 0;
}

.acct-device-app-name {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--ink-primary);
}

.acct-device-app-store {
    font-size: 0.8rem;
    line-height: 1.35;
    color: var(--ink-muted);
}

/* The dialog title carries the device's name, which may be long. */
.acct-device-dialog-title { overflow-wrap: anywhere; }

/* --- Code field (both pages) --------------------------------------------- */

.acct-code-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.6rem;
}

.acct-code-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1 1 14rem;
    min-width: 0;
    max-width: 22rem;
}

.acct-code-label {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--ink-muted);
}

/* Monospaced and spaced so K7QF-3MXP reads symbol by symbol against the
   device's screen. Upper-cased as typed; the code is case-insensitive.
   The field shares the card's cream, so its border is all that marks it out:
   --stone-500 (about 3.9:1), not --stone-300 (about 1.85:1). Hover and focus
   step to --stone-600 so those states still show. */
.acct-code-input {
    appearance: none;
    box-sizing: border-box;
    width: 100%;
    max-width: 22rem;
    flex: 1 1 14rem;
    min-width: 0;
    min-height: 2.6rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--stone-500);
    border-radius: 10px;
    background: var(--surface-base);
    color: var(--ink-primary);
    font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1.05rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    transition: border-color 120ms ease;
}

/* Inside a labelled field (/link) the input sits in a column: it must not take
   the row rule's flex-basis as its height. */
.acct-code-field .acct-code-input {
    flex: 0 0 auto;
    max-width: none;
}

/* The input and the button beside it share one height, so their edges line up. */
.acct-code-form .mud-button-root { min-height: 2.6rem; }

.acct-code-input:hover { border-color: var(--stone-600); }

/* Focus takes the house ring (2px --stone-500, offset), which a darker border
   alone would not make obvious now that the resting edge is --stone-500. */
.acct-code-input:focus-visible {
    outline: 2px solid var(--stone-500);
    outline-offset: 2px;
    border-color: var(--stone-600);
}

/* --- /link consent screen ------------------------------------------------- */

.acct-link-card { gap: 0.9rem; }

/* The platform's icon beside the question, so the device being linked is
   recognisable before a word is read. */
.acct-link-device {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

/* The question is the consent itself: platform first, then the quoted name.
   It wraps; nothing about it is ever cut off. */
.acct-link-question {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.4;
    color: var(--ink-primary);
    overflow-wrap: anywhere;
}

/* The code the person compares with their device. */
.acct-link-code {
    margin: 0;
    align-self: flex-start;
    padding: 0.45rem 0.8rem;
    border: 1px solid var(--stone-200);
    border-radius: 12px;
    background: var(--stone-100);
    color: var(--ink-primary);
    font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: clamp(1.5rem, 6vw, 2rem);
    font-weight: 700;
    letter-spacing: 0.14em;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    user-select: all;
}

.acct-link-check {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--ink-muted);
}

.acct-link-actions { margin-top: 0.15rem; }

/* Linked / Not linked: an icon and a sentence, never colour alone. */
.acct-link-outcome {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
}

.acct-link-outcome-icon {
    flex: 0 0 auto;
    display: inline-flex;
    margin-top: 0.12rem;
    color: var(--stone-600);
}

.acct-link-outcome-icon svg { width: 1.3rem; height: 1.3rem; }

.acct-link-outcome-msg {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.45;
    color: var(--ink-primary);
}

/* Headings that only take focus from code (tabindex="-1", after a stage change or an unlink
   removes the focused button), like h1 on navigation in app.css: not in the tab order, so no ring. */
.acct-focus-target:focus {
    outline: none;
}

@media (max-width: 520px) {
    .acct-device {
        grid-template-columns: auto minmax(0, 1fr);
        align-items: start;
    }

    .acct-device-unlink.mud-button-root {
        grid-column: 2;
        justify-self: start;
    }

    .acct-device-skel-button { display: none; }

    .acct-code-form .mud-button-root {
        flex: 1 1 auto;
    }

    .acct-code-field,
    .acct-code-input {
        max-width: none;
    }
}
