/*
    Account area — Settings and Subscription.

    One stylesheet for both pages so /settings, /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.  Settings        — the list, one setting, and its "Saved" line
     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; }
}

/* `.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(var(--stone-50-rgb), 0.7);
    color: var(--ink-primary);
    animation: acct-reveal 160ms ease-out;
}

.acct-banner.is-success {
    border-color: rgba(var(--stone-700-rgb), 0.22);
    background: rgba(var(--stone-300-rgb), 0.2);
}

.acct-banner.is-error {
    border-color: rgba(var(--rust-500-rgb), 0.32);
    background: rgba(var(--rust-500-rgb), 0.08);
    color: var(--rust-700);
}

.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: var(--rust-500); }

.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(var(--ink-primary-rgb), 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(var(--stone-100-rgb), 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(--fill-primary);
    color: var(--surface-base);
    border: 1px solid var(--fill-primary);
    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(var(--stone-50-rgb), 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(--fill-primary);
    border-color: var(--fill-primary);
    color: var(--surface-base);
}

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

/* A native range input (SettingHeadsUp.razor says 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(var(--stone-500-rgb), 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(var(--stone-500-rgb), 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(var(--stone-500-rgb), 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(var(--ink-primary-rgb), 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(var(--amber-400-rgb), 0.45);
    background: rgba(var(--amber-400-rgb), 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. Settings ═════════════════════════════════════════════════ */

/* Settings (Pages/Settings.razor): one list of everything that can be changed,
   each row showing what it is set to, and one setting's controls beside or in
   place of it. It took over from the Profile page's long form, whose sticky
   Save bar used to be this section: every control now saves as it changes, so
   there is nothing left to hold a bar open for.

   Colours here are tokens only. The dark theme is a separate change, and a
   literal written today is a rule someone has to find and fix then. */

/* One pane at a time below 1180px, both from there up. The list and the open
   setting are always both in the markup; which shows is decided here from the
   page's has-section class, so the same HTML serves a phone and a wide window.
   1180, not the 960 the web sidebar appears at: with that sidebar open, 960
   leaves the two panes about 630px to share, and the time picker's preview
   and the 24-hour quiet strip do not fit in half of that. */
.set-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--acct-stack-gap);
}

.set-list-pane,
.set-detail-pane {
    display: flex;
    flex-direction: column;
    gap: var(--acct-stack-gap);
    min-width: 0;
}

.set-page.has-section .set-list-pane,
.set-page:not(.has-section) .set-detail-pane {
    display: none;
}

@media (min-width: 1180px) {
    .set-page {
        max-width: 68rem;
    }

    .set-layout {
        grid-template-columns: minmax(17rem, 22rem) minmax(0, 1fr);
        gap: 2rem;
        align-items: start;
    }

    .set-page.has-section .set-list-pane,
    .set-page:not(.has-section) .set-detail-pane {
        display: flex;
    }

    /* The list is right there, so the way back to it is not needed. The
       is-always form is the link on the pages Settings leads out to
       (SettingsBackLink), which have no list beside them at any width. */
    .set-back:not(.is-always) {
        display: none;
    }

    /* Marks the setting open in the right-hand pane. Only here: on a narrow
       window the list is on its own and nothing is open beside it. */
    .set-row.is-current {
        background: var(--stone-100);
    }

    /* Each of these is drawn in both panes so that whichever one a narrow
       window is showing has it. Here both panes show, so one copy goes:
       the load error keeps the list's, and a change that did not save keeps
       the note under its own control, which is on screen beside the list. */
    .set-load-error.is-detail,
    .set-unsaved.is-beside {
        display: none;
    }
}

/* ——— Search ——— */

.set-search {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--stone-200);
    border-radius: 12px;
    background: var(--stone-50);
    color: var(--ink-muted);
    cursor: text;
}

.set-search:focus-within {
    border-color: var(--stone-500);
    outline: 2px solid var(--stone-500);
    outline-offset: 1px;
}

.set-search svg {
    width: 1.05rem;
    height: 1.05rem;
    flex: 0 0 auto;
}

.set-search-input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    outline: 0;
    padding: 0;
    background: transparent;
    font: inherit;
    font-size: 0.93rem;
    color: var(--ink-primary);
}

/* --ink-muted, not --ink-faint: the placeholder is the field's only visible
   label, and --ink-faint is about 3.3:1 on this surface. */
.set-search-input::placeholder {
    color: var(--ink-muted);
    opacity: 1;
}

.set-empty {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.2rem 0.2rem 0;
    font-size: 0.9rem;
    color: var(--ink-muted);
}

.set-empty p {
    margin: 0;
    overflow-wrap: anywhere;
}

/* ——— Groups and rows ——— */

.set-groups {
    display: flex;
    flex-direction: column;
    gap: var(--acct-stack-gap);
}

.set-group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

/* --ink-muted for the same reason as the placeholder: these headings are how
   the list is scanned. */
.set-group-title {
    margin: 0;
    padding: 0 0.2rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-muted);
}

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

.set-rows > li + li {
    border-top: 1px solid var(--stone-100);
}

/* 3rem tall at least: a row is a touch target first and a line of text second. */
.set-row {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-height: 3rem;
    padding: 0.6rem 0.8rem;
    color: inherit;
    text-decoration: none;
    transition: background 120ms ease;
}

.set-row:hover {
    background: var(--stone-50);
}

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

.set-row-icon {
    display: inline-flex;
    flex: 0 0 auto;
    color: var(--stone-600);
}

.set-row-icon svg {
    width: 1.2rem;
    height: 1.2rem;
}

.acct-avatar.set-row-avatar {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 0.95rem;
}

/* A title is never squeezed below its longest word: when a row runs out of
   room it is the value beside it that wraps. ("Plan" once broke after "Pla"
   on a phone.) The name row is the exception, because a name or an address
   can be one very long word, so it may break anywhere. */
.set-row-copy {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    flex: 1 1 auto;
    min-width: min-content;
}

.set-row-copy.is-name {
    min-width: 0;
}

/* Long values wrap; nothing in the list is cut short with an ellipsis. A row
   that hides half a time zone or an email address has stopped answering the
   question it is there to answer. */
.set-row-title {
    font-size: 0.93rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--ink-primary);
    overflow-wrap: break-word;
}

.set-row-copy.is-name .set-row-title {
    overflow-wrap: anywhere;
}

.set-row-detail {
    font-size: 0.8rem;
    line-height: 1.35;
    color: var(--ink-muted);
    overflow-wrap: anywhere;
}

/* "Change not saved", under the title of a setting whose save failed. The
   value beside it is still the stored one. Amber text on cream is the house
   colour for "needs a look" (the warning icon uses the same token). */
.set-row-detail.is-unsaved {
    font-weight: 600;
    color: var(--amber-600);
}

.set-row-value {
    flex: 0 1 auto;
    max-width: 55%;
    text-align: right;
    font-size: 0.84rem;
    line-height: 1.35;
    color: var(--ink-muted);
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.set-row-skel {
    width: 4rem;
    flex: 0 0 auto;
}

.set-row-chevron {
    display: inline-flex;
    flex: 0 0 auto;
    color: var(--stone-400);
}

.set-row-chevron svg {
    width: 0.9rem;
    height: 0.9rem;
}

/* ——— One setting ——— */

.set-back {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    align-self: flex-start;
    min-height: 2.75rem;
    margin: -0.5rem 0 -0.5rem -0.35rem;
    padding: 0 0.7rem 0 0.4rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ink-muted);
    text-decoration: none;
}

.set-back svg {
    width: 1rem;
    height: 1rem;
}

.set-back:hover {
    background: var(--stone-50);
    color: var(--ink-primary);
}

.set-back:focus-visible {
    outline: 2px solid var(--stone-500);
    outline-offset: 1px;
}

.set-card-title {
    font-size: 1.3rem;
}

/* Only where the name and address are allowed to run long: the identity block
   on the name setting. Its base rules cut them with an ellipsis. */
.acct-identity-name.set-wrap,
.acct-identity-email.set-wrap {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
}

/* ——— Where the last change stands (SettingSaveNote) ——— */

/* Keeps its height while empty, so "Saving…" and "Saved" appearing does not
   push the Related list down under a finger. */
.set-save {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 1.5rem;
}

.set-save-line {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.84rem;
    line-height: 1.5;
    color: var(--ink-muted);
}

.set-save-line.is-saved {
    font-weight: 600;
    color: var(--stone-600);
}

.set-save-line svg {
    width: 1rem;
    height: 1rem;
    flex: 0 0 auto;
}

/* Two classes, to outrank .acct-note and .acct-warning further down, which
   align to the top for notes that run to several lines. */
.set-save .set-save-box {
    align-items: center;
    flex-wrap: wrap;
}

/* The same note on the list, for a change that did not save after its own
   screen was left: which setting, why, "Try again" and a way back in. */
.set-list-pane .set-unsaved {
    align-items: center;
    flex-wrap: wrap;
}

.set-unsaved-actions {
    display: inline-flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.set-save-msg {
    flex: 1 1 14rem;
    min-width: 0;
    margin: 0;
}

.set-save-retry {
    appearance: none;
    flex: 0 0 auto;
    min-height: 2.25rem;
    padding: 0.35rem 0.8rem;
    border: 1px solid var(--stone-300);
    border-radius: 9px;
    background: var(--surface-base);
    font: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--ink-primary);
    cursor: pointer;
    transition: border-color 120ms ease, background 120ms ease;
}

/* "Open", beside "Try again", is a link drawn as the same button. */
a.set-save-retry {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.set-save-retry:hover {
    border-color: var(--stone-500);
    background: var(--stone-50);
}

.set-save-retry:focus-visible {
    outline: 2px solid var(--stone-500);
    outline-offset: 2px;
}

@media (pointer: coarse) {
    .set-save-retry {
        min-height: 2.75rem;
    }
}

/* ═══ 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(var(--stone-700-rgb), 0.09);
    border-color: rgba(var(--stone-700-rgb), 0.16);
    color: var(--stone-700);
}

.acct-status-attention {
    background: rgba(var(--amber-400-rgb), 0.2);
    border-color: rgba(var(--amber-400-rgb), 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(var(--rust-500-rgb), 0.1);
    border-color: rgba(var(--rust-500-rgb), 0.32);
    color: var(--rust-600);
}

/* — 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(var(--stone-50-rgb), 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(var(--stone-100-rgb), 0.55);
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--ink-muted);
}

.acct-note.is-attention {
    border-color: rgba(var(--amber-400-rgb), 0.45);
    background: rgba(var(--amber-400-rgb), 0.13);
}

.acct-note.is-problem {
    border-color: rgba(var(--rust-500-rgb), 0.28);
    background: rgba(var(--rust-500-rgb), 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: var(--rust-500); }
.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(var(--ink-primary-rgb), 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(var(--stone-500-rgb), 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;
    }
}

/* Below this a row of buttons stops fitting on one line, and a key…value row
   is better read stacked than squeezed. */
@media (max-width: 520px) {
    .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; }
}

/* ==========================================================================
   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(--fill-primary);
  border-color: var(--fill-primary);
  color: var(--surface-base);
}

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

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

.bill-btn-quiet:hover:not(:disabled) {
  background: rgba(var(--ink-primary-rgb), 0.05);
  border-color: transparent;
}

/* Red is reserved for the destructive confirm, never for a failed payment. */
.bill-btn-danger {
  border-color: rgba(var(--rust-500-rgb), 0.45);
  color: var(--rust-600);
}

.bill-btn-danger:hover:not(:disabled) {
  background: rgba(var(--rust-500-rgb), 0.08);
  border-color: var(--rust-600);
}

/* --- 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(var(--amber-400-rgb), 0.45);
  background: rgba(var(--amber-400-rgb), 0.12);
}

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

.bill-alert.is-problem {
  border-color: rgba(var(--rust-500-rgb), 0.35);
  background: rgba(var(--rust-500-rgb), 0.10);
}

.bill-alert.is-problem .bill-alert-msg {
  color: var(--rust-600);
}

.bill-alert.is-good {
  border-color: rgba(var(--stone-700-rgb), 0.2);
  background: rgba(var(--stone-700-rgb), 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(var(--stone-700-rgb), 0.09);
  color: var(--stone-700);
}

.bill-invoice-status.is-pending {
  background: rgba(var(--amber-400-rgb), 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: var(--rust-500); }
.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(var(--stone-100-rgb), 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: var(--amber-ink-soft); }
.sec-method.is-problem   .sec-method-meta { color: var(--rust-600); }

/* --- 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(var(--rust-500-rgb), 0.32);
  background: rgba(var(--rust-500-rgb), 0.07);
  border-radius: 11px;
  color: var(--rust-700);
  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: var(--rust-500) !important;
  color: var(--on-danger) !important;
}

.sec-btn-danger.mud-button-filled:hover:not(:disabled) {
  background: var(--rust-600) !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: var(--rust-500); }
.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(var(--on-fill-rgb), 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;
    }
}

/* ==========================================================================
   18. Guest pass — gp-*
   Account → Give a month (Client.Shared/Pages/GiveAMonth.razor) and Use a code
   (Pages/RedeemCode.razor). Both reuse .acct-page, .acct-header, .acct-card,
   .acct-banner, .acct-note, .acct-planstrip, the button skins and §17's code
   field; these rules cover only the pass itself, the link under it, the list
   of people who used it and the screen a used code ends on.
   As in §17: informational text is --ink-muted, never --ink-faint.
   ========================================================================== */

/* --- The pass -------------------------------------------------------------- */

/* A ticket, not a form: warm ground, the code large and alone in the middle.
   Its two side notches are the only decoration, drawn with the card's own
   background so they follow the theme. */
.gp-pass {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 1.15rem 1rem 1.05rem;
    border-radius: 14px;
    border: 1px solid rgba(var(--amber-400-rgb), 0.45);
    background: rgba(var(--amber-400-rgb), 0.11);
    text-align: center;
}

.gp-pass::before,
.gp-pass::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 0.9rem;
    height: 0.9rem;
    margin-top: -0.45rem;
    border-radius: 999px;
    border: 1px solid rgba(var(--amber-400-rgb), 0.45);
    background: var(--surface-base);
}

.gp-pass::before { left: -0.5rem; }
.gp-pass::after  { right: -0.5rem; }

.gp-pass-icon {
    display: inline-flex;
    color: var(--amber-600);
}

.gp-pass-icon svg { width: 1.6rem; height: 1.6rem; }

/* Monospaced and spaced like §17's device code, so 7KQ2-M4XD reads symbol by
   symbol. It wraps before it would ever be cut off at a large text size. */
.gp-pass-code {
    margin: 0;
    font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1.45rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    line-height: 1.3;
    color: var(--ink-primary);
    overflow-wrap: anywhere;
    user-select: all;
}

.gp-pass-left,
.gp-pass-renews {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--ink-muted);
}

/* A year that is used up goes quiet, not red: nothing is wrong. */
.gp-pass.is-spent {
    border-color: var(--stone-300);
    background: rgba(var(--stone-100-rgb), 0.55);
}

.gp-pass.is-spent::before,
.gp-pass.is-spent::after { border-color: var(--stone-300); }

.gp-pass.is-spent .gp-pass-icon { color: var(--ink-muted); }

.gp-pass.is-skeleton {
    border-color: var(--stone-200);
    background: transparent;
    gap: 0.6rem;
}

.gp-pass.is-skeleton::before,
.gp-pass.is-skeleton::after { display: none; }

.gp-skel-code { width: 11rem; max-width: 80%; height: 1.9rem; }
.gp-skel-line { width: 8rem; max-width: 60%; }

/* --- Sharing ---------------------------------------------------------------- */

/* The link itself, always on screen: the way to send it when the share sheet
   is missing and the clipboard is refused. One press selects all of it. */
.gp-link {
    margin: 0;
    font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.83rem;
    line-height: 1.5;
    color: var(--ink-muted);
    overflow-wrap: anywhere;
    user-select: all;
}

/* --- Used ------------------------------------------------------------------- */

.gp-use {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0;
    border-top: 1px solid var(--stone-100);
    font-size: 0.9rem;
}

.gp-use:first-child { border-top: none; padding-top: 0.1rem; }
.gp-use:last-child { padding-bottom: 0; }

.gp-use-icon { flex: 0 0 auto; display: inline-flex; color: var(--ink-muted); }
.gp-use-icon svg { width: 1.1rem; height: 1.1rem; }

/* A person chose this name: it wraps, whatever its length. */
.gp-use-name {
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 600;
    color: var(--ink-primary);
    overflow-wrap: anywhere;
}

.gp-use-when {
    flex: 0 0 auto;
    color: var(--ink-muted);
    font-variant-numeric: tabular-nums;
}

/* The shared strip label paints --ink-faint (fails AA at this size); this one
   carries a question a person needs to read. */
.acct-planstrip-label.gp-strip-label { color: var(--ink-muted); }

/* --- Use a code: done ------------------------------------------------------- */

.gp-done { align-items: flex-start; gap: 0.7rem; }

.gp-done-icon { display: inline-flex; color: var(--stone-600); }
.gp-done-icon svg { width: 1.9rem; height: 1.9rem; }

.gp-done-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.45;
    color: var(--ink-primary);
}

.gp-done-from {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ink-muted);
}

@media (max-width: 520px) {
    .gp-pass-code { font-size: 1.3rem; }

    /* Full-width buttons, stacked: two half-width ones squeeze "Share a pass". */
    .gp-actions .mud-button-root { flex: 1 1 100%; }
}

/* ── Settings → Pass it over (Pages/PassItOverPage.razor, docs/pass-it-over.md) ──────────────
   One row per link: an initial, the name and its line, and the row's buttons. Stopping opens
   the choice of what the stopped page says inside the row, never in a pop-up. */
.acct-ask-link {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.5rem 0.9rem;
    padding: 0.85rem 0;
    border-top: 1px solid var(--stone-100);
}

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

.acct-ask-initial {
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: var(--stone-200);
    color: var(--stone-800);
    font-weight: 700;
    font-size: 0.9rem;
}

.acct-ask-link.is-stopped .acct-ask-initial {
    background: var(--stone-100);
    color: var(--ink-muted);
}

.acct-ask-copy {
    min-width: 0;
}

.acct-ask-name {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--ink-primary);
    overflow-wrap: anywhere;
}

/* The same separator trick as .acct-device-meta: no line starts or ends with a dot. */
.acct-ask-meta {
    --acct-ask-sep: calc(1rem + 3px);
    margin: 0 0 0 calc(-1 * var(--acct-ask-sep));
    clip-path: inset(0 0 0 var(--acct-ask-sep));
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--ink-muted);
}

.acct-ask-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;
}

.acct-ask-buttons,
.acct-ask-stop {
    grid-column: 1 / -1;
}

.acct-ask-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
}

.acct-ask-buttons .mud-button-root,
.acct-ask-stop .mud-button-root,
.acct-ask-make .mud-button-root {
    text-transform: none;
}

.acct-ask-stop {
    margin: 0.25rem 0 0;
    padding: 0.85rem 0.9rem;
    border: 1px solid var(--stone-200);
    border-radius: 10px;
    background: var(--surface-base);
    display: grid;
    gap: 0.6rem;
    min-width: 0;
}

.acct-ask-stop legend,
.acct-ask-stop > p {
    margin: 0 0 0.25rem;
    padding: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ink-primary);
}

.acct-ask-choice {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    font-size: 0.88rem;
    line-height: 1.45;
    color: var(--ink-muted);
    cursor: pointer;
}

.acct-ask-choice input {
    margin-top: 0.2rem;
    accent-color: var(--stone-600);
    flex-shrink: 0;
}

.acct-ask-choice b {
    color: var(--ink-primary);
    font-weight: 600;
}

.acct-ask-make {
    display: grid;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.acct-ask-points {
    margin: 0;
    padding-left: 1.1rem;
    display: grid;
    gap: 0.45rem;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--ink-muted);
}

.acct-ask-points b {
    color: var(--ink-primary);
    font-weight: 600;
}

.acct-ask-fallback {
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 0.8rem;
    overflow-wrap: anywhere;
    user-select: all;
}

/* ==========================================================================
   19. AI assistants — acct-assistant-*
   Settings → AI assistants (Client.Shared/Pages/AiAssistants.razor,
   docs/ai-assistants-plan.md §5.5). The connected list reuses §17's rows,
   tile, count and empty well; the welcome follows Calendars' "Bring your
   calendar in" (integrations.css §5), and the numbered steps the guide's
   (guide.css .gd-steps). These rules cover only what is new here.

   Colour: the stone ramp only. Amber stays for time passing and rust for
   problems, so "Connected" and the ticks are ink on stone, never green, and
   every state is said in words beside its picture. As in §17, informational
   text is --ink-muted and a control's edge --stone-500 or darker. Tokens
   only, so the dark theme (timeline.css) follows without rules of its own.
   ========================================================================== */

/* --- Connected ------------------------------------------------------------ */

/* The name, then what it may do. The chip wraps under the name on a narrow
   screen rather than squeezing it. */
.acct-assistant-name {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem 0.55rem;
}

.acct-assistant-access {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    min-height: 1.45rem;
    padding: 0.05rem 0.55rem 0.05rem 0.45rem;
    border: 1px solid var(--stone-200);
    border-radius: 999px;
    background: var(--stone-100);
    font-size: 0.74rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--ink-muted);
    white-space: nowrap;
}

.acct-assistant-access svg,
.acct-assistant-connected svg {
    width: 0.85rem;
    height: 0.85rem;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.acct-assistant-none {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--ink-muted);
}

/* --- Connect: the welcome -------------------------------------------------- */

/* With nothing connected the card is the page's reason for being, so it gets
   Calendars' hero treatment: a centred mark, a title and one line. */
.acct-assistant-connect.is-hero { padding: 1.6rem 1.35rem 1.4rem; }

.acct-assistant-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    padding: 0.2rem 0 0.35rem;
    text-align: center;
}

/* Your tasks, a dashed join, a conversation: what connecting does, drawn
   with the page's own tiles rather than anyone's logo. */
.acct-assistant-hero-marks {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.45rem;
}

.acct-assistant-hero-marks .acct-device-icon {
    box-shadow: 0 2px 6px rgba(74, 62, 46, 0.08);
}

.acct-assistant-hero-link {
    width: 2.25rem;
    border-top: 2px dashed var(--stone-300);
}

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

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

/* --- Connect: three numbered steps ------------------------------------------ */

/* Numbered like the guide's steps, so "it takes three steps" can be seen at a
   glance, with a quiet line joining the numbers. The number sits in the
   padding; positioned rather than gridded, so a step can hold any number of
   blocks without the column needing rows of its own. */
.acct-assistant-steps {
    list-style: none;
    margin: 0.15rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
    counter-reset: acct-assistant-step;
}

.acct-assistant-step {
    position: relative;
    counter-increment: acct-assistant-step;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    min-width: 0;
    padding-inline-start: 2.65rem;
}

/* --fill-primary under --on-fill is the label-strength pair: 6.6:1 in the
   light theme, 7.2:1 in the dark one (timeline.css). */
.acct-assistant-step::before {
    content: counter(acct-assistant-step);
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    display: grid;
    place-items: center;
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 50%;
    background: var(--fill-primary);
    color: var(--on-fill);
    font-size: 0.85rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.acct-assistant-step:not(:last-child)::after {
    content: "";
    position: absolute;
    inset-inline-start: calc(0.925rem - 1px);
    top: 2.3rem;
    bottom: -0.95rem;
    border-inline-start: 2px solid var(--stone-200);
}

.acct-assistant-step-title {
    margin: 0;
    padding-top: 0.22rem;
    font-size: 0.98rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--ink-primary);
}

.acct-assistant-step-text {
    margin: 0;
    max-width: 34rem;
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--ink-muted);
}

/* Step 1: the address and Copy on one line; Copy drops under it on a narrow
   screen rather than squeezing it. */
.acct-assistant-address {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.6rem;
}

/* Monospaced like the device code, but as typed: an address is case-sensitive
   in its path, so nothing is upper-cased or spaced out. A box as big as its
   words: it wraps anywhere rather than cutting the end off at a large text
   size, and one tap or click selects all of it, like Pass it over's link
   (.acct-ask-fallback). Not a control, so a quieter edge than a field's. */
.acct-assistant-address-text {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    flex: 1 1 15rem;
    min-width: 0;
    min-height: 2.75rem;
    margin: 0;
    padding: 0.55rem 0.8rem;
    border: 1px solid var(--stone-300);
    border-radius: 10px;
    background: var(--surface-raised, var(--surface-base));
    color: var(--ink-primary);
    font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
    -webkit-user-select: all;
    user-select: all;
}

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

.acct-assistant-address .mud-button-root {
    min-height: 2.75rem;
    min-width: 6.5rem;
}

.acct-assistant-copy .mud-button-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.acct-assistant-copy-icon {
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* "Copied" stays until the next copy: nothing changes back by itself. */
.acct-assistant-copy.is-done.mud-button-outlined {
    border-color: var(--stone-500) !important;
    background: var(--stone-100) !important;
}

.acct-assistant-copy-problem {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--rust-500);
}

/* Step 2: one row per assistant, on the sunk wash Calendars' provider rows
   use. The link is the row's one action and says where it goes. */
.acct-assistant-apps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.acct-assistant-app {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.6rem 1rem;
    padding: 0.8rem 0.85rem 0.8rem 0.95rem;
    border: 1px solid var(--stone-200);
    border-radius: 13px;
    background: rgba(var(--stone-50-rgb), 0.55);
}

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

.acct-assistant-app-name {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem 0.55rem;
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--ink-primary);
}

/* Wraps, never ellipsised: these words say where the address goes. */
.acct-assistant-app-how {
    margin: 0;
    font-size: 0.83rem;
    line-height: 1.5;
    color: var(--ink-muted);
}

/* Ink on stone, with a tick and the word: --stone-700 on --stone-100 is about
   8:1 in either theme. */
.acct-assistant-connected {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    min-height: 1.4rem;
    padding: 0.05rem 0.5rem 0.05rem 0.4rem;
    border: 1px solid var(--stone-300);
    border-radius: 999px;
    background: var(--stone-100);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--stone-700);
    white-space: nowrap;
}

.acct-assistant-app-go {
    gap: 0.4rem;
    min-height: 2.6rem;
    white-space: nowrap;
}

.acct-assistant-app-go svg {
    width: 0.85rem;
    height: 0.85rem;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

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

/* --- What an assistant can see ---------------------------------------------- */

/* Two short lists side by side, one under the other when there isn't room. */
.acct-assistant-scope {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 1rem 1.75rem;
}

.acct-assistant-scope-title {
    margin: 0 0 0.5rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-muted);
}

.acct-assistant-scope-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.acct-assistant-scope-list li {
    display: grid;
    grid-template-columns: 1.15rem minmax(0, 1fr);
    gap: 0.55rem;
    font-size: 0.9rem;
    line-height: 1.45;
    color: var(--ink-primary);
}

.acct-assistant-scope-list svg {
    width: 1.15rem;
    height: 1.15rem;
    margin-top: 0.08rem;
    fill: none;
    stroke: var(--stone-700);
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.acct-assistant-scope-list.is-cannot svg { stroke: var(--ink-muted); }

.acct-assistant-scope-aside {
    display: block;
    margin-top: 0.1rem;
    font-size: 0.8rem;
    color: var(--ink-muted);
}

.acct-assistant-scope-note {
    margin: 0;
    padding-top: 0.85rem;
    border-top: 1px solid var(--stone-100);
    font-size: 0.84rem;
    line-height: 1.55;
    color: var(--ink-muted);
}

/* --- Narrow screens ------------------------------------------------------------ */

@media (max-width: 520px) {
    .acct-assistant-connect.is-hero { padding: 1.3rem 1rem 1.15rem; }

    /* The numbers stay; the column they sit in narrows. */
    .acct-assistant-step { padding-inline-start: 2.35rem; }

    /* Each link drops under its words, lined up with the name, instead of
       squeezing them into a narrow column. */
    .acct-assistant-app { grid-template-columns: minmax(0, 1fr); }
    .acct-assistant-app-go { justify-self: start; }

    /* Copy takes the full width once it has dropped under the address. */
    .acct-assistant-address .mud-button-root { flex: 1 1 100%; }
}
