:root {
    /* Surfaces */
    --bg: #f3f6fb;
    --surface: #ffffff;
    --surface-2: #f6f8fc;
    --border: #e7ecf4;
    --border-strong: #dbe3ef;

    /* Sidebar */
    --nav-bg-top: #12294f;
    --nav-bg-bottom: #091730;
    --nav-text: #a8bad6;
    --nav-text-active: #ffffff;
    --nav-active: rgba(255, 255, 255, .10);
    --nav-btn: #16325d;
    --logo: #b9f24d;

    /* Type */
    --text: #0f2545;
    --text-soft: #46587a;
    --muted: #7b8aa5;

    /* Accents */
    --accent: #2563eb;
    --grant: #16a34a;
    --deny: #dc2626;
    --warn: #b45309;

    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(15, 37, 69, .04), 0 8px 24px rgba(15, 37, 69, .05);
    --font: "Avenir Next", "Poppins", ui-rounded, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-soft);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 262px;
    display: flex;
    flex-direction: column;
    padding: 22px 18px;
    background: linear-gradient(180deg, var(--nav-bg-top) 0%, var(--nav-bg-bottom) 100%);
    color: var(--nav-text);
    z-index: 40;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px 26px;
}
.sidebar__brand strong { color: #fff; font-size: 19px; letter-spacing: -.2px; display: block; }
.sidebar__brand small { display: block; color: var(--nav-text); font-size: 12px; }

.sidebar__logo {
    width: 34px; height: 34px;
    display: grid; place-items: center;
    background: var(--logo);
    color: #0b1c38;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: .3px;
    flex-shrink: 0;
}

.sidebar__nav { display: flex; flex-direction: column; gap: 2px; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 11px 14px;
    border-radius: 12px;
    color: var(--nav-text);
    font-weight: 500;
    font-size: 15px;
    transition: background .15s ease, color .15s ease;
}
.nav-link svg { width: 19px; height: 19px; flex-shrink: 0; opacity: .9; }
.nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-link.is-active { background: var(--nav-active); color: var(--nav-text-active); font-weight: 600; }

.sidebar__foot { margin-top: auto; padding-top: 20px; }

.btn--signout {
    width: 100%;
    padding: 13px 16px;
    background: var(--nav-btn);
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 14px;
    color: #eaf1ff;
    font-weight: 600;
    cursor: pointer;
}
.btn--signout:hover { background: #1c3d72; border-color: rgba(255, 255, 255, .12); }

.app__main {
    flex: 1;
    min-width: 0;
    margin-left: 262px;
    display: flex;
    flex-direction: column;
}

/* ---------- Page header ---------- */
.pagebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 24px 34px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.pagebar__title { margin: 0; font-size: 25px; font-weight: 700; color: var(--text); letter-spacing: -.4px; }
.pagebar__sub { margin: 3px 0 0; color: var(--muted); font-size: 14px; }
.pagebar__user { color: var(--muted); font-size: 14px; text-align: right; }
.pagebar__user strong { display: block; color: var(--text); font-weight: 600; }

.sidebar-toggle {
    display: none;
    padding: 8px 10px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}

/* ---------- Layout ---------- */
.container { max-width: 1360px; margin: 0 auto; padding: 30px 34px 44px; width: 100%; }

.desk-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(340px, 1fr);
    gap: 22px;
    align-items: start;
}

@media (max-width: 1100px) {
    .desk-grid { grid-template-columns: 1fr; }
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 22px;
}

.card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 20px 24px 14px;
}

.card__head h2 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.2px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card__sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.card__action { color: var(--accent); font-size: 14px; font-weight: 600; white-space: nowrap; }
.card__action:hover { text-decoration: underline; }

.card__body { padding: 4px 24px 22px; }
.card__body--flush { padding: 0 0 6px; }

/* ---------- Stats ---------- */
.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
    gap: 20px;
    margin-bottom: 22px;
}

.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px 24px 20px;
}
.stat__label { color: var(--text-soft); font-size: 14px; font-weight: 500; }
.stat__value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--text);
    margin-top: 6px;
    letter-spacing: -.8px;
    font-variant-numeric: tabular-nums;
}
.stat__sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.stat--alert .stat__value { color: var(--deny); }
.stat--warn .stat__value { color: var(--warn); }

.meter { height: 6px; background: var(--surface-2); border-radius: 3px; margin-top: 14px; overflow: hidden; }
.meter__fill { height: 100%; background: var(--grant); border-radius: 3px; transition: width .4s ease; }
.meter__fill.is-high { background: #f59e0b; }
.meter__fill.is-full { background: var(--deny); }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; max-height: 480px; overflow-y: auto; }

.list__item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
}
.list__item:last-child { border-bottom: 0; }
.list__item--clickable { cursor: pointer; }
.list__item--clickable:hover { background: var(--surface-2); }

.list__main { flex: 1; min-width: 0; }
.list__title { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list__sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list__meta { text-align: right; color: var(--muted); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }

.avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: grid; place-items: center;
    font-size: 13px; font-weight: 600;
    color: var(--text-soft);
    flex-shrink: 0;
    object-fit: cover;
}

.empty { padding: 40px 24px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- Badges / decisions ---------- */
.badge {
    display: inline-block;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .1px;
}
.badge--grant { background: #dcfce7; color: #15803d; }
.badge--deny { background: #fee2e2; color: #b91c1c; }
.badge--manual { background: #dbeafe; color: #1d4ed8; }
.badge--warn { background: #fef3c7; color: #92400e; }
.badge--muted { background: #eef2f8; color: #64748b; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 7px; }
.dot--online { background: var(--grant); }
.dot--offline { background: var(--deny); }
.dot--unknown { background: #cbd5e1; }

.event-row { border-left: 3px solid transparent; }
.event-row--grant { border-left-color: #86efac; }
.event-row--deny { border-left-color: #fca5a5; }
.event-row.is-new { animation: flash 1.4s ease; }

@keyframes flash {
    0% { background: #eef4ff; }
    100% { background: transparent; }
}

/* ---------- Forms & buttons ---------- */
.input, .select, .textarea {
    width: 100%;
    padding: 11px 14px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    color: var(--text);
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.input::placeholder, .textarea::placeholder { color: #9fadc4; }
.input:focus, .select:focus, .textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.textarea { resize: vertical; min-height: 84px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.field__error { color: var(--deny); font-size: 13px; margin-top: 6px; }

.btn {
    padding: 10px 18px;
    border-radius: 12px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
    transition: background .15s ease, border-color .15s ease;
}
.btn:hover { background: var(--surface-2); border-color: #c9d5e6; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.btn--danger { background: #fff; border-color: #f4c7c7; color: var(--deny); }
.btn--danger:hover { background: #fef2f2; border-color: #f0a8a8; }
.btn--danger-solid { background: var(--deny); border-color: var(--deny); color: #fff; }
.btn--danger-solid:hover { background: #b91c1c; border-color: #b91c1c; }
.btn--danger-solid:disabled:hover { background: var(--deny); border-color: var(--deny); }

/* Trigger for a row's actions menu. */
.icon-btn {
    width: 32px; height: 32px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.icon-btn[aria-expanded="true"] { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }
.btn--sm { padding: 6px 13px; font-size: 13px; border-radius: 10px; }
.btn--block { width: 100%; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Busy button: the label stays in place (so the width does not jump) and a
   spinner sits on top of it. */
.btn.is-loading { position: relative; color: transparent !important; cursor: progress; }
.btn.is-loading::after {
    content: "";
    position: absolute;
    top: 50%; left: 50%;
    width: 16px; height: 16px;
    margin: -8px 0 0 -8px;
    border-radius: 50%;
    border: 2px solid rgba(15, 37, 69, .22);
    border-top-color: var(--text);
    animation: spin .6s linear infinite;
}
.btn--primary.is-loading::after, .btn--danger-solid.is-loading::after {
    border-color: rgba(255, 255, 255, .4);
    border-top-color: #fff;
}
.btn--danger.is-loading::after { border-color: rgba(220, 38, 38, .3); border-top-color: var(--deny); }

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .btn.is-loading::after { animation-duration: 1.8s; }
}

/* ---------- Checkbox options ---------- */
.check {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-2);
    cursor: pointer;
    margin-bottom: 10px;
}
.check:hover { border-color: var(--border-strong); }
.check input { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.check__label { font-size: 14px; font-weight: 600; color: var(--text); display: block; }
.check__hint { font-size: 12.5px; color: var(--muted); display: block; margin-top: 1px; }
.check.is-disabled { opacity: .55; cursor: not-allowed; }
.check.is-disabled input { cursor: not-allowed; }

/* ---------- Search ---------- */
.search-wrap { position: relative; }
.search-results {
    list-style: none; margin: 10px 0 0; padding: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    max-height: 320px; overflow-y: auto;
    background: var(--surface);
    box-shadow: var(--shadow);
}
.search-results:empty { display: none; }

/* ---------- Table ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 15px 24px; text-align: left; border-bottom: 1px solid var(--border); }
.table th {
    color: var(--muted);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 600;
    padding-top: 10px;
    padding-bottom: 10px;
}
.table td { color: var(--text-soft); }
.table td strong, .table td b { color: var(--text); font-weight: 600; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.is-inactive td { opacity: .55; }
.table__actions { width: 1%; text-align: right; white-space: nowrap; }
.table .num, .table td:last-child { font-variant-numeric: tabular-nums; }

/* ---------- Actions menu ---------- */
/* Positioned from JS against its trigger and appended to the body, so it is
   never clipped by the card it was opened from. */
.menu {
    position: fixed;
    z-index: 60;
    min-width: 194px;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(9, 23, 48, .16);
    animation: menu-in .12s ease;
}

.menu__item {
    display: block;
    width: 100%;
    padding: 9px 12px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
}
.menu__item:hover, .menu__item:focus-visible { background: var(--surface-2); outline: none; }
.menu__item--danger { color: var(--deny); }
.menu__item--danger:hover, .menu__item--danger:focus-visible { background: #fef2f2; }

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

/* ---------- Profile ---------- */
.profile__head {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 22px 24px;
    border-bottom: 1px solid var(--border);
}
.profile__avatar {
    width: 52px; height: 52px;
    display: grid; place-items: center;
    flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(180deg, var(--nav-bg-top) 0%, var(--nav-bg-bottom) 100%);
    color: #fff;
    font-size: 17px;
    font-weight: 700;
}
.profile__identity { flex: 1; min-width: 0; }
.profile__identity h3 { margin: 0; font-size: 19px; font-weight: 700; color: var(--text); letter-spacing: -.2px; }
.profile__badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 5px; }

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 2px 20px;
    margin: 0;
}
.detail { padding: 11px 0; border-bottom: 1px solid var(--border); }
.detail dt { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.detail dd { margin: 3px 0 0; font-size: 14.5px; color: var(--text); font-weight: 500; word-break: break-word; }

/* ---------- Notices ---------- */
.notice {
    margin: 0 0 18px;
    padding: 13px 15px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.55;
}
.notice--danger { background: #fef2f2; border: 1px solid #fbdada; color: #991b1b; }
.notice--warn { background: #fef3c7; border: 1px solid #fde68a; color: #92400e; }

/* ---------- Modal ---------- */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(9, 23, 48, .45);
    display: grid; place-items: center;
    padding: 20px;
    z-index: 50;
}
.modal-backdrop[hidden] { display: none; }

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    width: min(520px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 60px rgba(9, 23, 48, .22);
}
.modal__head { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal__head h3 { margin: 0; font-size: 17px; font-weight: 700; color: var(--text); }
.modal__body { padding: 22px 24px; }
.modal__foot { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; background: var(--surface-2); }

/* ---------- Toasts ---------- */
.toast-stack { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast {
    padding: 13px 18px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    color: var(--text);
    max-width: 360px;
    box-shadow: 0 12px 32px rgba(9, 23, 48, .16);
    animation: slide-in .22s ease;
}
.toast--success { border-left-color: var(--grant); }
.toast--error { border-left-color: var(--deny); }
.toast--warn { border-left-color: #f59e0b; }
.toast.is-leaving { opacity: 0; transition: opacity .3s ease; }

@keyframes slide-in {
    from { transform: translateX(16px); opacity: 0; }
    to { transform: none; opacity: 1; }
}

/* ---------- Login ---------- */
.auth-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    background: linear-gradient(180deg, var(--nav-bg-top) 0%, var(--nav-bg-bottom) 100%);
}
.auth-card {
    width: min(410px, 92vw);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 36px;
    box-shadow: 0 24px 60px rgba(4, 14, 32, .35);
}
.auth-card__logo {
    width: 44px; height: 44px;
    display: grid; place-items: center;
    background: var(--logo);
    color: #0b1c38;
    border-radius: 12px;
    font-weight: 700;
    margin-bottom: 18px;
}
.auth-card h1 { margin: 0 0 4px; font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -.3px; }
.auth-card p.sub { margin: 0 0 26px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.auth-card__foot { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); text-align: center; }

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.pulse { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--grant); margin-right: 7px; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* Only ever visible while the off-canvas menu is open; `hidden` keeps it out of
   the way of clicks on wide screens. */
.nav-scrim { display: none; }
.nav-scrim[hidden] { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: 0 0 60px rgba(9, 23, 48, .3);
    }
    body.nav-open .sidebar { transform: none; }
    .app__main { margin-left: 0; }
    .sidebar-toggle { display: block; }
    .pagebar { padding: 18px 20px; }
    .container { padding: 20px 20px 32px; }
    .card__head, .card__body, .list__item, .table th, .table td { padding-left: 18px; padding-right: 18px; }

    .nav-scrim {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(9, 23, 48, .45);
        z-index: 39;
    }
    .nav-scrim[hidden] { display: none; }
}

/* ==========================================================================
   Members & billing
   ========================================================================== */

/* ---------- Forms ---------- */
.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0 16px;
}
.field--wide { grid-column: 1 / -1; }

.field__hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; min-height: 1em; }
.field__hint--warn { color: var(--warn); }
.field__hint--ok { color: var(--grant); }

.check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    font-size: 14px;
    cursor: pointer;
}
.check input { margin-top: 3px; flex-shrink: 0; }

.modal--wide { width: min(760px, 100%); }

/* ---------- Stepper ---------- */
.stepper {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.stepper__step {
    font-size: 12.5px;
    color: var(--muted);
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--surface-2);
    white-space: nowrap;
}
.stepper__step.is-active { background: var(--accent); color: #fff; font-weight: 600; }
.stepper__step.is-done { color: var(--grant); }

/* ---------- PAR-Q ---------- */
.parq { margin-bottom: 18px; }
.parq__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.parq__row:last-child { border-bottom: 0; }
.parq__toggle { display: flex; gap: 14px; flex-shrink: 0; color: var(--muted); font-size: 13px; }
.parq__toggle label { display: flex; align-items: center; gap: 5px; cursor: pointer; }

/* ---------- Signature pad ---------- */
.signature {
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 10px;
    background: var(--surface-2);
}
.signature canvas {
    display: block;
    width: 100%;
    height: 160px;
    border-radius: 6px;
    background: rgba(0, 0, 0, .18);
    touch-action: none;
    cursor: crosshair;
}
.signature .btn { margin-top: 10px; }

/* ---------- Totals ---------- */
.totals {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
    margin: 14px 0;
}
.totals__row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}
.totals__row--credit { color: var(--grant); }
.totals__row--total {
    border-top: 1px solid var(--border);
    margin-top: 6px;
    padding-top: 10px;
    font-weight: 650;
    font-size: 16px;
}

/* ---------- Tabs ---------- */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}
.tab {
    background: none;
    border: 0;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    padding: 10px 16px;
    cursor: pointer;
    font-weight: 550;
    white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- Key/value panels ---------- */
.kv {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.kv:last-child { border-bottom: 0; }
.kv > span { color: var(--muted); font-size: 12.5px; }
.kv--stack { display: block; }
.kv--stack > div { margin-top: 4px; }

.is-warn { color: var(--warn); }

.notice {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--muted);
}
.notice--warn { border-left-color: var(--warn); color: var(--text); margin: 12px 0; }

/* ---------- Member profile ---------- */
.profile-head {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.profile-head__main { flex: 1; min-width: 220px; }
.profile-head__main h2 {
    margin: 0 0 4px;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.profile-head__stats { display: flex; gap: 24px; }
.profile-head__stats span { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; }
.profile-head__stats strong { font-size: 20px; font-variant-numeric: tabular-nums; }

.avatar--lg { width: 64px; height: 64px; font-size: 20px; }

/* ---------- Table extras ---------- */
.row--clickable { cursor: pointer; }
.row--clickable:hover { background: var(--surface-2); }

.cell-with-avatar { display: flex; align-items: center; gap: 12px; }

@media (max-width: 640px) {
    .parq__row { flex-direction: column; align-items: flex-start; gap: 8px; }
    .profile-head__stats { width: 100%; justify-content: space-between; }
}

/* ---------- Dialogs (replaces window.confirm / prompt / alert) ---------- */
.dialog-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(9, 23, 48, .6);
    display: grid;
    place-items: center;
    padding: 20px;
    /* Above page modals — a dialog is always raised from one. */
    z-index: 200;
    animation: dialog-fade .12s ease;
}

.dialog {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: min(460px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
    animation: dialog-rise .16s ease;
}
.dialog__head { padding: 18px 20px 0; }
.dialog__head h3 { margin: 0; font-size: 16.5px; }
.dialog__body { padding: 14px 20px 4px; }
.dialog__message { margin: 0 0 14px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.dialog__body .field:last-of-type { margin-bottom: 4px; }
.dialog__foot {
    padding: 14px 20px 18px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

@keyframes dialog-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes dialog-rise {
    from { transform: translateY(8px) scale(.99); opacity: 0; }
    to { transform: none; opacity: 1; }
}

/* ---------- Gate console ---------- */
.check {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
}
.check:last-child { border-bottom: 0; }
.check .badge { flex-shrink: 0; min-width: 62px; text-align: center; }
.check .muted { font-size: 13.5px; margin-top: 2px; }
.check__hint {
    margin-top: 6px;
    font-size: 13px;
    padding: 7px 10px;
    border-radius: 6px;
    background: var(--surface-2);
    border-left: 2px solid var(--accent);
}

.test-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 13px 0;
    border-bottom: 1px solid var(--border);
}
.test-row:last-child { border-bottom: 0; }
.test-row .muted { font-size: 13px; margin-top: 3px; max-width: 52ch; }
.test-row .btn { flex-shrink: 0; }

.steps { margin: 0 0 12px; padding-left: 20px; font-size: 14px; line-height: 1.65; }
.steps li { margin-bottom: 7px; }

@media (max-width: 640px) {
    .test-row { flex-direction: column; align-items: stretch; }
    .test-row .btn { width: 100%; }
}
