:root {
    color-scheme: light;
    --rotary-blue: #005daa;
    --rotary-blue-dark: #003b6f;
    --rotary-gold: #f7a81b;
    --ink: #243746;
    --muted: #63788a;
    --surface: #ffffff;
    --background: #eef4f8;
    --line: #d9e4ec;
    --success: #16835f;
    --warning: #9a6500;
    --danger: #b42318;
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(150deg, #f8fbfd 0%, var(--background) 58%, #dbe9f3 100%);
    color: var(--ink);
}

.shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 20px;
}

.shell--narrow .brand-card {
    max-width: 680px;
}

.brand-card {
    width: min(100%, 820px);
    padding: clamp(28px, 5vw, 56px);
    border: 1px solid rgba(0, 93, 170, 0.12);
    border-radius: 22px;
    background: var(--surface);
    box-shadow: 0 22px 60px rgba(0, 61, 111, 0.14);
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--rotary-blue);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    color: var(--rotary-blue-dark);
    font-size: clamp(2rem, 5vw, 3.6rem);
    line-height: 1.06;
    letter-spacing: -0.035em;
}

.lead {
    max-width: 650px;
    margin: 22px 0 0;
    color: var(--muted);
    font-size: 1.08rem;
    line-height: 1.65;
}

.status-card,
.notice {
    display: flex;
    gap: 14px;
    margin-top: 34px;
    padding: 18px 20px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #f8fbfd;
}

.status-card p,
.notice p,
.check-item p {
    margin: 5px 0 0;
    color: var(--muted);
    line-height: 1.45;
}

.status-dot {
    flex: 0 0 auto;
    width: 12px;
    height: 12px;
    margin-top: 5px;
    border-radius: 50%;
    background: var(--rotary-gold);
    box-shadow: 0 0 0 5px rgba(247, 168, 27, 0.16);
}

.notice--warning {
    border-color: rgba(154, 101, 0, 0.25);
    background: #fffaf0;
}

.notice--success {
    border-color: rgba(22, 131, 95, 0.28);
    background: #f0fbf6;
}

.notice--error {
    border-color: rgba(180, 35, 24, 0.28);
    background: #fff5f4;
}

.notice p {
    margin: 0;
}

.setup-form {
    display: grid;
    gap: 12px;
    margin-top: 32px;
}

.setup-form label {
    font-weight: 750;
}

.setup-form input {
    width: 100%;
    min-height: 48px;
    padding: 10px 13px;
    border: 1px solid #b9c9d5;
    border-radius: 10px;
    color: var(--ink);
    font: inherit;
}

.setup-form input:focus {
    outline: 3px solid rgba(0, 93, 170, 0.16);
    border-color: var(--rotary-blue);
}

.setup-form button {
    justify-self: start;
    min-height: 46px;
    padding: 0 20px;
    border: 0;
    border-radius: 10px;
    background: var(--rotary-blue);
    color: #ffffff;
    font: inherit;
    font-weight: 750;
    cursor: pointer;
}

.auth-form {
    display: grid;
    gap: 11px;
    margin-top: 32px;
}

.auth-form--section {
    padding-top: 28px;
    border-top: 1px solid var(--line);
}

.auth-form label {
    margin-top: 7px;
    font-weight: 780;
}

.auth-form input,
.auth-form select {
    width: 100%;
    min-height: 50px;
    padding: 11px 13px;
    border: 1px solid #b9c9d5;
    border-radius: 10px;
    background: #ffffff;
    color: var(--ink);
    font: inherit;
}

.auth-form input:focus,
.auth-form select:focus {
    outline: 3px solid rgba(0, 93, 170, 0.16);
    border-color: var(--rotary-blue);
}

.button {
    justify-self: start;
    min-height: 48px;
    margin-top: 10px;
    padding: 0 22px;
    border: 1px solid var(--rotary-blue);
    border-radius: 10px;
    background: var(--rotary-blue);
    color: #ffffff;
    font: inherit;
    font-weight: 780;
    cursor: pointer;
}

.button:hover,
.button:focus-visible {
    background: var(--rotary-blue-dark);
    border-color: var(--rotary-blue-dark);
}

.button--secondary {
    background: #ffffff;
    color: var(--rotary-blue-dark);
}

.inline-form {
    margin-top: 26px;
}

.field-help,
.security-note {
    margin: -3px 0 3px;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.security-note {
    margin-top: 24px;
}

.dashboard-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 24px;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 5px 11px;
    border-radius: 999px;
    background: #eaf4fb;
    color: var(--rotary-blue-dark);
    font-size: 0.85rem;
    font-weight: 800;
    white-space: nowrap;
}

.status-card--success {
    border-color: rgba(22, 131, 95, 0.25);
    background: #f0fbf6;
}

.status-icon {
    display: grid;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    place-items: center;
    border-radius: 50%;
    background: var(--success);
    color: #ffffff;
    font-weight: 900;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 22px;
}

.module-card {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #ffffff;
}

.module-card > span {
    color: var(--rotary-blue);
    font-size: 0.75rem;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.module-card h2 {
    margin: 7px 0 0;
    color: var(--rotary-blue-dark);
    font-size: 1.14rem;
}

.module-card p,
.account-row p {
    margin: 7px 0 0;
    color: var(--muted);
    line-height: 1.5;
}

.module-card--next {
    border-color: rgba(0, 93, 170, 0.28);
    background: #f6fafd;
}

.module-card--locked {
    opacity: 0.72;
}

.shell--top {
    align-items: start;
}

.shell--wide .brand-card {
    max-width: 1180px;
}

.brand-card--wide {
    width: min(100%, 1180px);
}

.module-card-link {
    color: inherit;
    text-decoration: none;
    transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.module-card-link:hover,
.module-card-link:focus-visible {
    border-color: var(--rotary-blue);
    box-shadow: 0 10px 24px rgba(0, 61, 111, 0.1);
    transform: translateY(-2px);
    outline: none;
}

.back-link,
.table-action {
    color: var(--rotary-blue);
    font-weight: 780;
    text-decoration: none;
}

.back-link {
    display: inline-block;
    margin-bottom: 12px;
}

.back-link:hover,
.back-link:focus-visible,
.table-action:hover,
.table-action:focus-visible {
    color: var(--rotary-blue-dark);
    text-decoration: underline;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 28px;
}

.summary-card {
    display: grid;
    gap: 3px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f8fbfd;
}

.summary-card strong {
    color: var(--rotary-blue-dark);
    font-size: 1.7rem;
}

.summary-card span {
    color: var(--muted);
    font-size: 0.9rem;
}

.filter-form {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(150px, 210px) auto auto;
    align-items: end;
    gap: 12px;
    margin-top: 28px;
}

.filter-form label,
.form-grid label,
.pin-form label {
    display: block;
    margin-bottom: 7px;
    font-weight: 780;
}

.filter-form input,
.filter-form select,
.pin-form input {
    width: 100%;
    min-height: 48px;
    padding: 10px 13px;
    border: 1px solid #b9c9d5;
    border-radius: 10px;
    background: #ffffff;
    color: var(--ink);
    font: inherit;
}

.filter-form input:focus,
.filter-form select:focus,
.pin-form input:focus {
    outline: 3px solid rgba(0, 93, 170, 0.16);
    border-color: var(--rotary-blue);
}

.button--compact {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    margin-top: 0;
    padding: 0 18px;
    text-decoration: none;
}

.button--danger {
    border-color: var(--danger);
    background: var(--danger);
}

.button--danger:hover,
.button--danger:focus-visible {
    border-color: #7a1710;
    background: #7a1710;
}

.member-table-wrap {
    margin-top: 24px;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
}

.member-table {
    width: 100%;
    min-width: 920px;
    border-collapse: collapse;
    background: #ffffff;
}

.member-table th,
.member-table td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.member-table th {
    background: #f4f8fb;
    color: var(--muted);
    font-size: 0.78rem;
    letter-spacing: 0.035em;
    text-transform: uppercase;
}

.member-table tbody tr:last-child td {
    border-bottom: 0;
}

.member-table tbody tr:hover {
    background: #f8fbfd;
}

.member-name {
    color: var(--rotary-blue-dark);
    font-weight: 780;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
    white-space: nowrap;
}

.badge--active,
.badge--pin {
    background: #e5f6ef;
    color: #0f684b;
}

.badge--inactive,
.badge--empty {
    background: #edf2f5;
    color: #526778;
}

.empty-state {
    padding: 28px !important;
    color: var(--muted);
    text-align: center !important;
}

.edit-panel {
    margin-top: 34px;
    padding-top: 30px;
    border-top: 1px solid var(--line);
    scroll-margin-top: 24px;
}

.section-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 18px;
}

.section-head h2 {
    margin: 0;
    color: var(--rotary-blue-dark);
    font-size: clamp(1.45rem, 3vw, 2rem);
}

.form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 18px;
}

.form-grid > div {
    min-width: 0;
}

.form-grid--full {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    scroll-margin-top: 24px;
}

.form-actions .notice--inline {
    flex: 1 1 320px;
}

.management-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 28px;
}

.management-card {
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #f8fbfd;
}

.management-card h3 {
    margin: 0;
    color: var(--rotary-blue-dark);
}

.management-card > p {
    margin: 8px 0 0;
    color: var(--muted);
    line-height: 1.5;
}

.management-result {
    scroll-margin-top: 24px;
}

.notice--inline {
    margin-top: 10px;
    padding: 13px 15px;
}

.pin-form {
    display: grid;
    gap: 9px;
    margin-top: 18px;
}

.pin-form label:not(:first-of-type) {
    margin-top: 5px;
}

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

.account-list {
    display: grid;
    gap: 10px;
    margin-top: 24px;
}

.account-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 15px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f8fbfd;
}

code {
    padding: 0.12em 0.34em;
    border-radius: 5px;
    background: rgba(0, 61, 111, 0.08);
    color: var(--rotary-blue-dark);
    font-size: 0.92em;
}

.check-list {
    display: grid;
    gap: 12px;
    margin: 32px 0 0;
    padding: 0;
    list-style: none;
}

.check-item {
    display: flex;
    gap: 13px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.check-item > span {
    display: grid;
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 50%;
    color: #ffffff;
    font-weight: 900;
}

.check-item--ok > span {
    background: var(--success);
}

.check-item--error > span {
    background: var(--danger);
}

@media (max-width: 560px) {
    .shell {
        align-items: start;
        padding: 16px 12px;
    }

    .brand-card {
        border-radius: 16px;
    }

    .dashboard-head,
    .account-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .module-grid {
        grid-template-columns: 1fr;
    }

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

    .filter-form,
    .form-grid,
    .management-grid {
        grid-template-columns: 1fr;
    }

    .form-grid--full {
        grid-column: auto;
    }

    .section-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .button {
        width: 100%;
    }
}
