/* ============================================================================
   ICOPAD — Dashboard shell
   PRD: §15 (dashboards), §19 (accessibility), §22 (role visibility)

   This file is the shell: sidebar, main, alerts, page header, cards,
   account/privacy forms, membership history, and shared badge utilities.

   Submissions-specific styles live in submissions.css (loaded AFTER
   this file). Do not add .submissions-* or .submission-item* rules here.
   ============================================================================ */

/* ═══════════════════════════════════════════════════════════════════════
   APP SHELL — sidebar + main grid
   ═══════════════════════════════════════════════════════════════════════ */

.app-shell {
    display: block;                     /* mobile-first: no grid */
    background: var(--bg-subtle, #fafafa);
    min-height: calc(100dvh - var(--header-height-mobile, 56px));
    margin: 0;
    padding: 0;
}

@media (min-width: 1024px) {
    .app-shell {
        display: grid;
        grid-template-columns: 280px 1fr;
        min-height: calc(100dvh - var(--header-height, 64px));
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════════════════ */

.app-sidebar {
    background: var(--surface, #fff);
    border-right: 1px solid var(--border-subtle, #eaeaea);
    padding: 1rem 1rem .5rem;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    font-feature-settings: "kern" 1, "liga" 1, "calt" 1, "cv11" 1, "ss01" 1;
}

@media (max-width: 1023px) {
    .app-sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--border-subtle, #eaeaea);
        padding: .75rem 1rem;
    }
}

@media (min-width: 1024px) {
    .app-sidebar {
        position: sticky;
        top: var(--header-height, 64px);
        align-self: start;
        max-height: calc(100dvh - var(--header-height, 64px));
        overflow-y: auto;
        padding: 1.25rem 1rem .75rem;
    }
}

/* ── User card ──────────────────────────────────────────────────── */

.app-sidebar__user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-subtle, #fafafa);
    border: 1px solid var(--border-subtle, #eaeaea);
    border-radius: 12px;
    flex-shrink: 0;
    position: relative;
}
.app-sidebar__user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg,
        var(--brand, #0a4d8c),
        color-mix(in srgb, var(--brand, #0a4d8c) 70%, #000));
    color: #fff;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    flex-shrink: 0;
    text-transform: uppercase;
}
.app-sidebar__user-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}
.app-sidebar__user-name {
    font-size: .875rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text, #111);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}
.app-sidebar__user-email {
    font-size: .75rem;
    font-weight: 400;
    color: var(--text-muted, #666);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
    margin-top: 1px;
}

@media (max-width: 639px) {
    .app-sidebar__user { padding: 8px 10px; gap: 8px; }
    .app-sidebar__user-avatar { width: 30px; height: 30px; font-size: .8125rem; }
    .app-sidebar__user-name { font-size: .8125rem; }
    .app-sidebar__user-email { font-size: .6875rem; }
}

/* ── Mobile toggle ──────────────────────────────────────────────── */

.app-sidebar__toggle {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    background: transparent;
    border: 1px solid var(--border, #d4d4d4);
    border-radius: 10px;
    color: var(--text, #111);
    font: inherit;
    font-size: .8125rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease;
}
.app-sidebar__toggle:hover { background: var(--surface-hover, #f3f3f3); }
.app-sidebar__toggle:focus-visible {
    outline: 2px solid var(--brand, #0a4d8c);
    outline-offset: 2px;
}
@media (max-width: 1023px) {
    .app-sidebar__toggle { display: inline-flex; }
}

/* ── Mobile drawer head ─────────────────────────────────────────── */

.app-sidebar__drawer-head {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: .5rem .5rem .25rem;
    border-bottom: 1px solid var(--border-subtle, #eaeaea);
    margin-bottom: .5rem;
}
.app-sidebar__drawer-title {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--text-subtle, #888);
}
.app-sidebar__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 8px;
    border: 1px solid var(--border-subtle, #eaeaea);
    background: var(--surface, #fff);
    color: var(--text-muted, #666);
    cursor: pointer;
}
.app-sidebar__close:hover { background: var(--surface-hover, #f3f3f3); }
.app-sidebar__close:focus-visible {
    outline: 2px solid var(--brand, #0a4d8c);
    outline-offset: 2px;
}
@media (max-width: 1023px) {
    .app-sidebar__drawer-head { display: flex; }
}

/* ── Nav ────────────────────────────────────────────────────────── */

.app-sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: .875rem;
    flex: 1;
    min-height: 0;
}

@media (max-width: 1023px) {
    .app-sidebar__nav {
        display: none;
        padding-top: .5rem;
    }
    .app-sidebar__nav.is-open { display: flex; }
}

.app-sidebar__section {
    font-size: .6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--text-subtle, #888);
    margin: 0;
    padding: 0 10px;
    line-height: 1.2;
}
.app-sidebar__section + ul { margin-top: -.25rem; }
.app-sidebar__nav > ul + p { margin-top: .5rem; }

.app-sidebar__nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.app-sidebar__nav a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: .8125rem;
    font-weight: 500;
    letter-spacing: -0.005em;
    color: var(--text, #111);
    text-decoration: none;
    border-radius: 8px;
    transition: background-color .15s ease, color .15s ease;
    justify-content: space-between;
    position: relative;
    line-height: 1.35;
}
.app-sidebar__nav a:hover,
.app-sidebar__nav a:focus-visible {
    background: var(--surface-hover, #f3f3f3);
    outline: none;
}
.app-sidebar__nav a[aria-current="page"] {
    background: color-mix(in srgb, var(--brand, #0a4d8c) 10%, transparent);
    color: var(--brand, #0a4d8c);
    font-weight: 600;
    letter-spacing: -0.008em;
}
.app-sidebar__nav a[aria-current="page"]::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--brand, #0a4d8c);
}

.app-sidebar__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
.app-sidebar__nav a[aria-current="page"] .app-sidebar__badge {
    background: var(--brand, #0a4d8c);
    color: #fff;
}

/* ── Sidebar inline form (super admin backup) ───────────────────── */

.app-sidebar__inline-form { display: block; }
.app-sidebar__inline-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    font: inherit;
    font-size: .8125rem;
    font-weight: 500;
    letter-spacing: -0.005em;
    color: var(--text, #111);
    background: transparent;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color .15s ease;
}
.app-sidebar__inline-btn:hover { background: var(--surface-hover, #f3f3f3); }
.app-sidebar__inline-btn:focus-visible {
    outline: 2px solid var(--brand, #0a4d8c);
    outline-offset: 2px;
}

/* ── Sidebar footer / sign out ─────────────────────────────────── */

.app-sidebar__footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle, #eaeaea);
    flex-shrink: 0;
}
.app-sidebar__signout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    font: inherit;
    font-size: .8125rem;
    font-weight: 600;
    letter-spacing: 0.005em;
    color: var(--text-muted, #666);
    background: transparent;
    border: 1px solid var(--border, #d4d4d4);
    border-radius: 8px;
    cursor: pointer;
    transition: all .15s ease;
}
.app-sidebar__signout:hover,
.app-sidebar__signout:focus-visible {
    color: #b91c1c;
    border-color: #fca5a5;
    background: #fef2f2;
    outline: none;
}

/* ═══════════════════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════════════════ */

.app-main {
    padding: 1.25rem;
    min-width: 0;
    font-feature-settings: "kern" 1, "liga" 1, "calt" 1, "cv11" 1, "ss01" 1;
}
@media (min-width: 640px) {
    .app-main { padding: 1.5rem; }
}
@media (min-width: 1024px) {
    .app-main { padding: 2rem 2.5rem; }
}

/* ── Alerts ─────────────────────────────────────────────────────── */

.app-main .alert {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: .875rem;
    font-weight: 500;
    letter-spacing: -0.005em;
    margin-bottom: 1rem;
    line-height: 1.5;
}
.app-main .alert-error {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
}
.app-main .alert-success {
    background: #d1fae5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}
.app-main .alert-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

/* ═══════════════════════════════════════════════════════════════════════
   PAGE HEADER
   ═══════════════════════════════════════════════════════════════════════ */

.dash-head {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    margin-bottom: 1.75rem;
    /* No max-width by default — bounded by the grid column. */
}
@media (max-width: 639px) {
    .dash-head { margin-bottom: 1.25rem; gap: .5rem; }
}
.dash-head__eyebrow {
    font-size: .6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--brand, #0a4d8c);
    margin: 0;
    line-height: 1.2;
}
.dash-head__title {
    font-size: clamp(1.5rem, 1.25rem + 1.2vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin: 0;
    color: var(--text, #111);
    text-wrap: balance;
}
.dash-head__lead {
    font-size: .9375rem;
    font-weight: 400;
    line-height: 1.6;
    color: var(--text-muted, #555);
    margin: 0;
    max-width: 620px;
    text-wrap: pretty;
}

/* ═══════════════════════════════════════════════════════════════════════
   CARDS
   The default card is intended for reading-width content (account,
   membership history). Pages that need a full-width card add the
   .dash-card--wide modifier.
   ═══════════════════════════════════════════════════════════════════════ */

.dash-card {
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e5e5e5);
    border-radius: 16px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    max-width: 780px;
    box-shadow: 0 1px 2px 0 rgb(22 20 19 / 0.03);
}
@media (min-width: 640px) {
    .dash-card { padding: 1.5rem; }
}
.dash-card:last-of-type { margin-bottom: 0; }

/* Full-width variant — used by lists that should fill the grid column. */
.dash-card--wide {
    max-width: none;
}
.dash-head--wide,
.dash-counters--wide {
    max-width: none;
}

.dash-card__head {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-subtle, #eaeaea);
}
.dash-card__title {
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    line-height: 1.3;
    margin: 0 0 4px;
    color: var(--text, #111);
}
.dash-card__lead {
    font-size: .8125rem;
    font-weight: 400;
    line-height: 1.55;
    color: var(--text-muted, #555);
    margin: 0;
    text-wrap: pretty;
}
.dash-card__body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.dash-card__note {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    background: var(--bg-subtle, #fafafa);
    border: 1px solid var(--border-subtle, #eaeaea);
    border-radius: 10px;
    font-size: .8125rem;
    font-weight: 400;
    line-height: 1.55;
    color: var(--text-muted, #555);
}
.dash-card__note-icon {
    color: var(--brand, #0a4d8c);
    flex-shrink: 0;
    margin-top: 1px;
}
.dash-card__note p { margin: 0; }
.dash-card__note a {
    color: var(--brand, #0a4d8c);
    text-decoration: underline;
    font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════════════
   BADGES — shared utility
   ═══════════════════════════════════════════════════════════════════════ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    border-radius: 999px;
    background: var(--bg-muted, #f1f1f1);
    color: var(--text-muted, #555);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    line-height: 1.3;
}
.badge--ok      { background: #d1fae5; color: #065f46; }
.badge--warn    { background: #fef3c7; color: #92400e; }
.badge--bad     { background: #fee2e2; color: #991b1b; }
.badge--info    { background: #dbeafe; color: #1e40af; }
.badge--neutral { background: var(--bg-muted, #f1f1f1); color: var(--text-muted, #555); }

.text-muted {
    color: var(--text-subtle, #888);
    font-size: .875rem;
    font-weight: 400;
}

/* ═══════════════════════════════════════════════════════════════════════
   ADMIN-BADGE aliases (used on org dashboard, membership history)
   So pages render correctly even if admin.css is not loaded.
   ═══════════════════════════════════════════════════════════════════════ */

.admin-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    border-radius: 999px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    line-height: 1.3;
}
.admin-badge--ok      { background: #d1fae5; color: #065f46; }
.admin-badge--info    { background: #dbeafe; color: #1e40af; }
.admin-badge--warn    { background: #fef3c7; color: #92400e; }
.admin-badge--bad     { background: #fee2e2; color: #991b1b; }
.admin-badge--neutral { background: var(--bg-muted, #f1f1f1); color: var(--text-muted, #555); }

/* ═══════════════════════════════════════════════════════════════════════
   ACCOUNT & PRIVACY
   ═══════════════════════════════════════════════════════════════════════ */

.account-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: .875rem 1.5rem;
    margin: 0;
}
@media (min-width: 640px) {
    .account-grid { grid-template-columns: 160px 1fr; }
}
.account-grid__item { display: contents; }
.account-grid__item > dt {
    font-size: .6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--text-subtle, #888);
    margin: 0;
    padding-top: 2px;
    line-height: 1.3;
}
.account-grid__item > dd {
    font-size: .9375rem;
    font-weight: 500;
    letter-spacing: -0.005em;
    color: var(--text, #111);
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    line-height: 1.5;
    text-wrap: pretty;
}

.privacy-info {
    padding: 14px 16px;
    background: color-mix(in srgb, var(--brand, #0a4d8c) 4%, transparent);
    border: 1px solid color-mix(in srgb, var(--brand, #0a4d8c) 15%, var(--border-subtle, #eaeaea));
    border-radius: 12px;
}
.privacy-info__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.privacy-info__list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: .875rem;
    line-height: 1.55;
    color: var(--text, #111);
    text-wrap: pretty;
}
.privacy-info__list li strong { font-weight: 600; }
.privacy-info__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 1px;
}
.privacy-info__icon--on      { background: #d1fae5; color: #065f46; }
.privacy-info__icon--off     { background: #fee2e2; color: #991b1b; }
.privacy-info__icon--neutral { background: var(--bg-muted, #f1f1f1); color: var(--text-muted, #555); }

.account-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.account-form__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.account-form__label {
    font-size: .8125rem;
    font-weight: 600;
    letter-spacing: -0.005em;
    color: var(--text, #111);
}
.account-form__field textarea {
    padding: 12px 14px;
    font: inherit;
    font-size: .9375rem;
    font-weight: 400;
    line-height: 1.55;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #d4d4d4);
    border-radius: 10px;
    color: var(--text, #111);
    resize: vertical;
    min-height: 100px;
    transition: border-color .15s ease, box-shadow .15s ease;
    width: 100%;
}
.account-form__field textarea:focus {
    outline: none;
    border-color: var(--brand, #0a4d8c);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand, #0a4d8c) 20%, transparent);
}
.account-form__field-foot {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
}
.account-form__hint {
    font-size: .75rem;
    font-weight: 400;
    color: var(--text-subtle, #888);
    margin: 0;
    line-height: 1.5;
}
.account-form__counter {
    font-size: .75rem;
    font-weight: 500;
    color: var(--text-subtle, #888);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    margin-left: auto;
}
.account-form__error {
    font-size: .8125rem;
    font-weight: 500;
    color: #b91c1c;
    margin: 0;
}

.account-form__switch {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    padding: 12px 14px;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e5e5e5);
    border-radius: 12px;
    transition: border-color .15s ease, background-color .15s ease;
}
.account-form__switch:hover {
    border-color: color-mix(in srgb, var(--brand, #0a4d8c) 30%, var(--border, #e5e5e5));
}
.account-form__switch input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.account-form__switch-track {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 24px;
    border-radius: 999px;
    background: var(--border, #d4d4d4);
    flex-shrink: 0;
    transition: background-color .2s ease;
    margin-top: 1px;
}
.account-form__switch-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgb(0 0 0 / .15);
    transition: transform .2s ease;
}
.account-form__switch input:checked ~ .account-form__switch-track {
    background: var(--brand, #0a4d8c);
}
.account-form__switch input:checked ~ .account-form__switch-track .account-form__switch-thumb {
    transform: translateX(16px);
}
.account-form__switch input:focus-visible ~ .account-form__switch-track {
    outline: 2px solid var(--brand, #0a4d8c);
    outline-offset: 2px;
}
.account-form__switch-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.account-form__switch-label strong {
    font-size: .9375rem;
    font-weight: 600;
    letter-spacing: -0.005em;
    color: var(--text, #111);
    line-height: 1.35;
}
.account-form__switch-hint {
    font-size: .75rem;
    font-weight: 400;
    color: var(--text-muted, #666);
    line-height: 1.4;
}

.account-form__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding-top: 1rem;
    border-top: 1px dashed var(--border, #e5e5e5);
}
.account-form__actions-note {
    font-size: .75rem;
    font-weight: 400;
    color: var(--text-subtle, #888);
    margin: 0;
}

.account-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.account-actions__item {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-subtle, #fafafa);
    border: 1px solid var(--border-subtle, #eaeaea);
    border-radius: 12px;
}
@media (min-width: 640px) {
    .account-actions__item {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 1.5rem;
    }
}
.account-actions__title {
    font-size: .9375rem;
    font-weight: 600;
    letter-spacing: -0.005em;
    margin: 0 0 2px;
    color: var(--text, #111);
    line-height: 1.35;
}
.account-actions__desc {
    font-size: .8125rem;
    font-weight: 400;
    line-height: 1.55;
    color: var(--text-muted, #555);
    margin: 0;
    text-wrap: pretty;
}
.account-actions__item .btn {
    flex-shrink: 0;
    min-height: 40px;
    padding-inline: 20px;
    border-radius: 10px;
    align-self: flex-start;
    font-size: .8125rem;
    font-weight: 600;
    letter-spacing: -0.005em;
}
@media (min-width: 640px) {
    .account-actions__item .btn { align-self: center; }
}

.account-rights {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.account-rights li {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 14px;
    background: var(--bg-subtle, #fafafa);
    border: 1px solid var(--border-subtle, #eaeaea);
    border-radius: 10px;
}
.account-rights strong {
    font-size: .875rem;
    font-weight: 600;
    letter-spacing: -0.005em;
    color: var(--text, #111);
}
.account-rights span {
    font-size: .8125rem;
    font-weight: 400;
    color: var(--text-muted, #555);
    line-height: 1.55;
    text-wrap: pretty;
}
.account-rights a {
    color: var(--brand, #0a4d8c);
    text-decoration: underline;
    font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════════════
   ORGANISATION DASHBOARD — extras
   ═══════════════════════════════════════════════════════════════════════ */

.completeness-meter {
    width: 100%;
    height: 8px;
    background: var(--bg-subtle, #fafafa);
    border-radius: 999px;
    overflow: hidden;
    margin-top: .5rem;
    border: 1px solid var(--border-subtle, #eaeaea);
}
.completeness-meter__fill {
    height: 100%;
    background: linear-gradient(
        90deg,
        var(--brand, #0a4d8c),
        color-mix(in srgb, var(--brand, #0a4d8c) 70%, #000)
    );
    transition: width .3s ease;
}

.admin-notice {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px;
    border-radius: 12px;
    margin-top: 1rem;
    font-size: .875rem;
    line-height: 1.55;
}
.admin-notice p { margin: 0; }
.admin-notice--info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}
.admin-notice--warn {
    background: #fef3c7;
    border: 1px solid #fde68a;
    color: #92400e;
}
@media (min-width: 640px) {
    .admin-notice { flex-direction: row; align-items: center; justify-content: space-between; }
}

.admin-list__note {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 14px;
    background: var(--bg-subtle, #fafafa);
    border-left: 3px solid color-mix(in srgb, var(--brand, #0a4d8c) 40%, transparent);
    border-radius: 8px;
    font-size: .8125rem;
}
.admin-list__note > span:first-child {
    font-size: .6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--text-subtle, #888);
}

.admin-list__actions {
    padding-left: 0;
    background: transparent;
    border: 0;
}
.admin-list__actions a {
    color: var(--brand, #0a4d8c);
    font-weight: 600;
    text-decoration: none;
    font-size: .8125rem;
}
.admin-list__actions a:hover { text-decoration: underline; }

/* ── Edit profile form ──────────────────────────────────────────── */

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-width: 780px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
@media (min-width: 640px) {
    .form-row { grid-template-columns: 1fr 1fr; }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.form-group > label,
.form-group > legend {
    font-size: .8125rem;
    font-weight: 600;
    letter-spacing: -0.005em;
    color: var(--text, #111);
}
.form-group--fieldset {
    border: 0;
    padding: 0;
    margin: 0;
}
.form-group--fieldset > legend {
    padding: 0;
    margin-bottom: .25rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="url"],
.form-group textarea {
    padding: 10px 14px;
    font: inherit;
    font-size: .9375rem;
    font-weight: 400;
    line-height: 1.55;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #d4d4d4);
    border-radius: 10px;
    color: var(--text, #111);
    transition: border-color .15s ease, box-shadow .15s ease;
    width: 100%;
}
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--brand, #0a4d8c);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand, #0a4d8c) 20%, transparent);
}

.form-error {
    font-size: .8125rem;
    font-weight: 500;
    color: #b91c1c;
    margin: 0;
}

.form-hint {
    font-size: .75rem;
    font-weight: 400;
    color: var(--text-subtle, #888);
    margin: 0;
    line-height: 1.5;
}

.check-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    margin-top: .5rem;
}
@media (min-width: 640px) {
    .check-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
    .check-grid { grid-template-columns: repeat(3, 1fr); }
}

.check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--border, #e5e5e5);
    border-radius: 8px;
    font-size: .875rem;
    font-weight: 400;
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease;
    user-select: none;
}
.check-item:hover {
    border-color: color-mix(in srgb, var(--brand, #0a4d8c) 40%, var(--border, #e5e5e5));
    background: color-mix(in srgb, var(--brand, #0a4d8c) 4%, transparent);
}
.check-item input[type="checkbox"] {
    margin: 0;
    accent-color: var(--brand, #0a4d8c);
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════════════════ */

.dash-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    padding: 2rem 1rem;
}
.dash-empty__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--brand, #0a4d8c) 10%, transparent);
    color: var(--brand, #0a4d8c);
    margin-bottom: .5rem;
}
.dash-empty__title {
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin: 0;
    color: var(--text, #111);
    line-height: 1.3;
}
.dash-empty__body {
    font-size: .9375rem;
    font-weight: 400;
    line-height: 1.6;
    color: var(--text-muted, #555);
    margin: 0;
    max-width: 520px;
    text-wrap: pretty;
}
.dash-empty__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: .75rem;
}
@media (max-width: 640px) {
    .dash-empty__actions { flex-direction: column; width: 100%; }
    .dash-empty__actions .btn { width: 100%; justify-content: center; }
}

/* ═══════════════════════════════════════════════════════════════════════
   MEMBERSHIP & PAYMENT HISTORY
   PRD: §8, §8.1, §15.1
   ═══════════════════════════════════════════════════════════════════════ */

.membership-summary {
    display: grid;
    grid-template-columns: 1fr;
    gap: .75rem;
    margin-bottom: 1.5rem;
    max-width: 900px;
}
@media (min-width: 640px) {
    .membership-summary { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
    .membership-summary { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
}

.membership-summary__card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 1rem 1.25rem;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e5e5e5);
    border-radius: 14px;
}
.membership-summary__label {
    font-size: .6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--text-subtle, #888);
    line-height: 1.3;
}
.membership-summary__value {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text, #111);
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
}
.membership-summary__badge {
    align-self: flex-start;
    font-size: .75rem;
    padding: 4px 10px;
}

.membership-table-wrap {
    overflow-x: auto;
    margin-inline: -1.25rem;
    padding-inline: 1.25rem;
    padding-bottom: .25rem;
    -webkit-overflow-scrolling: touch;
}
@media (min-width: 768px) {
    .membership-table-wrap {
        margin-inline: 0;
        padding-inline: 0;
    }
}

.membership-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
    line-height: 1.5;
}
.membership-table thead {
    background: var(--bg-subtle, #fafafa);
    border-top: 1px solid var(--border-subtle, #eaeaea);
    border-bottom: 1px solid var(--border-subtle, #eaeaea);
}
.membership-table th {
    padding: 12px 14px;
    font-size: .6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--text-subtle, #888);
    text-align: left;
    white-space: nowrap;
}
.membership-table th.membership-table__num { text-align: right; }

.membership-table tbody tr {
    border-bottom: 1px solid var(--border-subtle, #eaeaea);
    transition: background-color .15s ease;
}
.membership-table tbody tr:hover {
    background: color-mix(in srgb, var(--brand, #0a4d8c) 3%, transparent);
}
.membership-table tbody tr:last-child { border-bottom: 0; }

.membership-table td {
    padding: 14px;
    vertical-align: top;
    color: var(--text, #111);
}
.membership-table td.membership-table__num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.membership-table strong {
    font-weight: 600;
    letter-spacing: -0.005em;
}

.membership-table__sep {
    color: var(--text-subtle, #bbb);
    margin: 0 4px;
    font-weight: 300;
}
.membership-table__meta {
    font-size: .75rem;
    color: var(--text-muted, #666);
    margin: 4px 0 0;
    line-height: 1.4;
}
.membership-table__meta--mono {
    font-family: ui-monospace, "SFMono-Regular", "Menlo", "Consolas", monospace;
    font-size: .6875rem;
    letter-spacing: 0;
    color: var(--text-subtle, #888);
}

.provider-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    font-size: .6875rem;
    font-weight: 600;
    letter-spacing: .02em;
    border-radius: 6px;
    white-space: nowrap;
    line-height: 1.4;
}
.provider-tag--stripe  { background: #ede9fe; color: #5b21b6; }
.provider-tag--manual  { background: #e0f2fe; color: #075985; }
.provider-tag--bank    { background: #fef3c7; color: #92400e; }
.provider-tag--waiver  { background: #d1fae5; color: #065f46; }
.provider-tag--neutral { background: var(--bg-muted, #f1f1f1); color: var(--text-muted, #555); }

@media (max-width: 767px) {
    .membership-table-wrap {
        overflow-x: visible;
        margin-inline: 0;
        padding-inline: 0;
    }
    .membership-table,
    .membership-table thead,
    .membership-table tbody,
    .membership-table tr,
    .membership-table td {
        display: block;
        width: 100%;
    }
    .membership-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        border: 0;
    }
    .membership-table tbody tr {
        border: 1px solid var(--border, #e5e5e5);
        border-radius: 12px;
        margin-bottom: .875rem;
        padding: .75rem 1rem;
        background: var(--surface, #fff);
    }
    .membership-table tbody tr:hover { background: var(--surface, #fff); }
    .membership-table td {
        padding: .375rem 0;
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 1rem;
        border-bottom: 1px dashed var(--border-subtle, #eaeaea);
    }
    .membership-table td:last-child { border-bottom: 0; }
    .membership-table td::before {
        content: attr(data-label);
        font-size: .6875rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .1em;
        color: var(--text-subtle, #888);
        flex-shrink: 0;
        margin-right: .5rem;
    }
    .membership-table td.membership-table__num { text-align: left; }
    .membership-table__meta { text-align: right; }
}

/* ═══════════════════════════════════════════════════════════════════════
   ROLE-AWARE SIDEBAR TESTING HOOKS
   ═══════════════════════════════════════════════════════════════════════ */

[data-user-role] .app-sidebar__user::after {
    content: attr(data-user-role);
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: .625rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--brand, #0a4d8c) 12%, transparent);
    color: var(--brand, #0a4d8c);
    pointer-events: none;
    display: none;
}
/* Uncomment to show the role chip for RBAC testing */
/*
[data-user-role] .app-sidebar__user::after { display: inline-block; }
*/

/* ═══════════════════════════════════════════════════════════════════════
   REDUCED MOTION
   ═══════════════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    .app-sidebar__nav a,
    .app-sidebar__toggle,
    .app-sidebar__inline-btn,
    .app-sidebar__signout,
    .account-form__switch-track,
    .account-form__switch-thumb,
    .account-form__switch,
    .account-form__field textarea {
        transition-duration: .01ms !important;
    }
}