/* ==========================================================================
   SportWare Material 3.0 Component Styles & Responsive App Shell
   ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family: var(--md-ref-typeface-plain);
    font-size: 14px;
    line-height: 1.5;
    color: var(--md-sys-color-on-surface);
    background-color: var(--md-sys-color-surface);
    -webkit-font-smoothing: antialiased;
    transition: background-color var(--md-sys-motion-duration-medium) var(--md-sys-motion-standard),
                color var(--md-sys-motion-duration-medium) var(--md-sys-motion-standard);
}

h1, h2, h3, h4 {
    margin: 0;
    font-family: var(--md-ref-typeface-brand);
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--md-sys-color-on-surface);
}

h1:focus {
    outline: none;
}

a {
    color: var(--md-sys-color-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.material-symbols-rounded {
    font-family: 'Material Symbols Rounded';
    font-weight: normal;
    font-style: normal;
    font-size: 20px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}

.icon-filled {
    font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}

/* ---------- Splash & Loading ---------- */

.m3-splash {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px;
}

.m3-splash-mark {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    display: grid;
    place-items: center;
}

.m3-splash-mark .material-symbols-rounded {
    font-size: 32px;
}

.m3-splash-title {
    font-family: var(--md-ref-typeface-brand);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.m3-linear-progress {
    width: 220px;
    max-width: 100%;
    height: 4px;
    border-radius: var(--md-sys-shape-full);
    background: var(--md-sys-color-surface-container-highest);
    overflow: hidden;
    position: relative;
}

.m3-linear-progress.full-width {
    width: 100%;
}

.m3-linear-progress-bar {
    position: absolute;
    inset: 0 auto 0 0;
    width: 45%;
    border-radius: var(--md-sys-shape-full);
    background: var(--md-sys-color-primary);
    animation: m3-indeterminate 1.25s var(--md-sys-motion-standard) infinite;
}

@keyframes m3-indeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(320%); }
}

/* ---------- App Shell (M3 Adaptive Drawer + Rail + Top Bar) ---------- */

.m3-shell {
    display: grid;
    grid-template-columns: 264px minmax(0, 1fr);
    min-height: 100vh;
}

.m3-nav-drawer {
    background: var(--md-sys-color-surface-container-low);
    padding: 16px 12px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid var(--md-sys-color-outline-variant);
    z-index: 30;
}

.m3-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px 18px;
}

.m3-brand-badge {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.m3-brand-badge .material-symbols-rounded {
    font-size: 22px;
}

.m3-brand-name {
    font-family: var(--md-ref-typeface-brand);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.15;
    color: var(--md-sys-color-on-surface);
}

.m3-brand-sub {
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--md-sys-color-on-surface-variant);
}

.m3-nav-section-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--md-sys-color-on-surface-variant);
    padding: 12px 16px 4px;
}

.m3-nav-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.m3-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 48px;
    padding: 0 16px;
    border-radius: var(--md-sys-shape-full);
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 500;
    font-size: 14px;
    text-decoration: none;
    transition: background-color var(--md-sys-motion-duration-short) var(--md-sys-motion-standard),
                color var(--md-sys-motion-duration-short) var(--md-sys-motion-standard);
}

.m3-nav-item:hover {
    text-decoration: none;
    background: var(--md-sys-state-hover);
    color: var(--md-sys-color-on-surface);
}

.m3-nav-item.active {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    font-weight: 600;
}

.m3-nav-item.active .material-symbols-rounded {
    font-variation-settings: 'FILL' 1, 'wght' 600, 'GRAD' 0, 'opsz' 24;
}

.m3-nav-footer {
    margin-top: auto;
    padding: 12px 14px;
    border-radius: var(--md-sys-shape-lg);
    background: var(--md-sys-color-surface-container);
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.m3-nav-footer-endpoint {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 11px;
    color: var(--md-sys-color-on-surface);
    word-break: break-all;
}

.m3-main-column {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.m3-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: 64px;
    padding: 0 24px;
    background: var(--md-sys-color-surface);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.m3-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.m3-topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.m3-persona-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border-radius: var(--md-sys-shape-full);
    background: var(--md-sys-color-surface-container-high);
    border: 1px solid var(--md-sys-color-outline-variant);
}

.m3-club-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    width: 100%;
}

.m3-club-brand-logo {
    height: 38px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
    border-radius: 8px;
    flex-shrink: 0;
}

.m3-club-brand-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--md-sys-color-on-surface);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.m3-club-switcher {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 4px 12px 12px;
    padding: 10px 12px;
    border-radius: var(--md-sys-shape-md);
    background: var(--md-sys-color-surface-container-high);
    border: 1px solid var(--md-sys-color-outline-variant);
}

.m3-club-switcher-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--md-sys-color-on-surface-variant);
}

.m3-active-club-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 12px 12px;
    padding: 8px 12px;
    border-radius: var(--md-sys-shape-md);
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    font-size: 13px;
    font-weight: 600;
}

.m3-active-club-pill-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.m3-club-logo-thumb {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--md-sys-color-surface-container-high);
    border: 1px solid var(--md-sys-color-outline-variant);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    padding: 4px;
}

.m3-club-logo-thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.m3-logo-preview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.m3-logo-preview-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 12px;
    border-radius: var(--md-sys-shape-md);
    border: 1px solid var(--md-sys-color-outline-variant);
    min-height: 92px;
}

.m3-logo-preview-tile.light {
    background: #FFFBF9;
    color: #241918;
}

.m3-logo-preview-tile.dark {
    background: #1B1211;
    color: #F4E4E1;
}

.m3-logo-preview-tile img {
    max-height: 44px;
    max-width: 160px;
    object-fit: contain;
}

@media (max-width: 720px) {
    .m3-persona-wrap select {
        max-width: 140px !important;
    }
}

.m3-icon-btn.m3-menu-toggle {
    display: none;
}

.m3-topbar-brand {
    display: none;
    align-items: center;
    text-decoration: none;
}

.m3-topbar-subtitle {
    font-family: var(--md-ref-typeface-brand);
    font-weight: 600;
    font-size: 16px;
    color: var(--md-sys-color-on-surface);
}

.m3-content {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 28px 28px 56px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

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

.m3-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}

.m3-page-title {
    font-size: 28px;
    line-height: 1.2;
    font-weight: 700;
}

.m3-page-subtitle {
    margin: 4px 0 0;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 14px;
}

.m3-header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

/* ---------- Buttons & FAB (Material 3) ---------- */

.m3-btn,
.m3-fab-extended,
.m3-icon-btn {
    font-family: var(--md-ref-typeface-plain);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.01em;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color var(--md-sys-motion-duration-short) var(--md-sys-motion-standard),
                box-shadow var(--md-sys-motion-duration-short) var(--md-sys-motion-standard),
                transform var(--md-sys-motion-duration-short) var(--md-sys-motion-standard),
                border-color var(--md-sys-motion-duration-short) var(--md-sys-motion-standard);
}

.m3-btn:disabled,
.m3-fab-extended:disabled,
.m3-icon-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.m3-btn {
    height: 40px;
    padding: 0 20px;
    border-radius: var(--md-sys-shape-full);
}

.m3-btn-sm {
    height: 34px;
    padding: 0 14px;
    font-size: 13px;
}

.m3-btn-filled {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.m3-btn-filled:hover {
    text-decoration: none;
    box-shadow: var(--md-sys-elevation-1);
    filter: brightness(1.06);
}

.m3-btn-tonal {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.m3-btn-tonal:hover {
    text-decoration: none;
    box-shadow: var(--md-sys-elevation-1);
    filter: brightness(0.97);
}

.m3-btn-outlined {
    background: transparent;
    color: var(--md-sys-color-primary);
    border: 1px solid var(--md-sys-color-outline);
}

.m3-btn-outlined:hover {
    text-decoration: none;
    background: var(--md-sys-state-primary-hover);
}

.m3-btn-text {
    background: transparent;
    color: var(--md-sys-color-primary);
    padding: 0 12px;
}

.m3-btn-text:hover {
    text-decoration: none;
    background: var(--md-sys-state-primary-hover);
}

.m3-btn-danger {
    background: var(--md-sys-color-error);
    color: var(--md-sys-color-on-error);
}

.m3-btn-danger:hover {
    filter: brightness(1.06);
}

.m3-btn-danger-tonal {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

.m3-btn-danger-tonal:hover {
    filter: brightness(0.96);
}

.m3-fab-extended {
    height: 48px;
    padding: 0 20px 0 16px;
    border-radius: var(--md-sys-shape-lg);
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    font-weight: 600;
    box-shadow: var(--md-sys-elevation-2);
}

.m3-fab-extended:hover {
    box-shadow: var(--md-sys-elevation-3);
    transform: translateY(-1px);
}

.m3-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--md-sys-shape-full);
    background: transparent;
    color: var(--md-sys-color-on-surface-variant);
}

.m3-icon-btn:hover {
    background: var(--md-sys-state-hover);
    color: var(--md-sys-color-on-surface);
}

.m3-icon-btn.danger:hover {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

/* ---------- Cards & Surfaces ---------- */

.m3-card {
    background: var(--md-sys-color-surface-container-lowest);
    border-radius: var(--md-sys-shape-lg);
    border: 1px solid var(--md-sys-color-outline-variant);
    padding: 20px 24px;
}

.m3-card-filled {
    background: var(--md-sys-color-surface-container-low);
    border-radius: var(--md-sys-shape-lg);
    padding: 20px 24px;
}

.m3-card-elevated {
    background: var(--md-sys-color-surface-container-lowest);
    border-radius: var(--md-sys-shape-lg);
    box-shadow: var(--md-sys-elevation-1);
    padding: 20px 24px;
}

.m3-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.m3-section-title {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---------- Search & Filter Bar ---------- */

.m3-filter-panel {
    background: var(--md-sys-color-surface-container-low);
    border-radius: var(--md-sys-shape-xl);
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.m3-search-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.m3-search-box {
    flex: 1 1 280px;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 44px;
    padding: 0 16px;
    border-radius: var(--md-sys-shape-full);
    background: var(--md-sys-color-surface-container-lowest);
    border: 1px solid var(--md-sys-color-outline-variant);
    transition: border-color var(--md-sys-motion-duration-short) var(--md-sys-motion-standard);
}

.m3-search-box:focus-within {
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 0 0 1px var(--md-sys-color-primary);
}

.m3-search-box input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: var(--md-sys-color-on-surface);
    font-size: 14px;
    font-family: inherit;
}

.m3-search-box .material-symbols-rounded {
    color: var(--md-sys-color-on-surface-variant);
}

.m3-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.m3-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 14px;
    border-radius: var(--md-sys-shape-sm);
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--md-sys-color-outline-variant);
    background: var(--md-sys-color-surface-container-lowest);
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    transition: background-color var(--md-sys-motion-duration-short) var(--md-sys-motion-standard),
                border-color var(--md-sys-motion-duration-short) var(--md-sys-motion-standard),
                color var(--md-sys-motion-duration-short) var(--md-sys-motion-standard);
}

.m3-chip:hover {
    background: var(--md-sys-state-hover);
    color: var(--md-sys-color-on-surface);
}

.m3-chip.selected {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    border-color: transparent;
}

.m3-chip .material-symbols-rounded {
    font-size: 16px;
}

.m3-chip-static {
    cursor: default;
}

.m3-chip-static:hover {
    background: var(--md-sys-color-surface-container-lowest);
    color: var(--md-sys-color-on-surface-variant);
}

/* Status & Category Tonal Badges */

.m3-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 26px;
    padding: 0 10px;
    border-radius: var(--md-sys-shape-sm);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.m3-badge-active {
    background: var(--md-sys-color-success-container);
    color: var(--md-sys-color-on-success-container);
}

.m3-badge-trial {
    background: var(--md-sys-color-tertiary-container);
    color: var(--md-sys-color-on-tertiary-container);
}

.m3-badge-pending {
    background: var(--md-sys-color-warning-container);
    color: var(--md-sys-color-on-warning-container);
}

.m3-badge-expired,
.m3-badge-suspended {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

.m3-badge-inactive,
.m3-badge-general {
    background: var(--md-sys-color-surface-container-highest);
    color: var(--md-sys-color-on-surface-variant);
}

.m3-badge-coaching {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.m3-badge-committee {
    background: var(--md-sys-color-tertiary-container);
    color: var(--md-sys-color-on-tertiary-container);
}

.m3-badge-administration {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

/* ---------- Form Controls (M3 Outlined Fields) ---------- */

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

.m3-form-grid .span-2 {
    grid-column: span 2;
}

.m3-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.m3-field label {
    font-size: 12px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
    letter-spacing: 0.02em;
}

.m3-input,
.m3-select,
.m3-textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    border-radius: var(--md-sys-shape-sm);
    border: 1px solid var(--md-sys-color-outline);
    background: var(--md-sys-color-surface-container-lowest);
    color: var(--md-sys-color-on-surface);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color var(--md-sys-motion-duration-short) var(--md-sys-motion-standard),
                box-shadow var(--md-sys-motion-duration-short) var(--md-sys-motion-standard);
}

.m3-select-compact {
    min-height: 40px;
    height: 40px;
    padding: 0 12px;
    width: auto;
    min-width: 118px;
    border-radius: var(--md-sys-shape-full);
    border-color: var(--md-sys-color-outline-variant);
}

.m3-textarea {
    min-height: 84px;
    resize: vertical;
}

.m3-input:focus,
.m3-select:focus,
.m3-textarea:focus {
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 0 0 1px var(--md-sys-color-primary);
}

.m3-field-hint {
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
}

.validation-message,
.m3-field-error {
    font-size: 12px;
    color: var(--md-sys-color-error);
}

/* ---------- Data Table ---------- */

.m3-table-wrap {
    background: var(--md-sys-color-surface-container-lowest);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-lg);
    overflow: hidden;
}

.m3-table-scroll {
    overflow-x: auto;
}

.m3-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.m3-table th {
    padding: 14px 16px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--md-sys-color-on-surface-variant);
    background: var(--md-sys-color-surface-container-low);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    white-space: nowrap;
}

.m3-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    vertical-align: middle;
}

.m3-table tbody tr:last-child td {
    border-bottom: none;
}

.m3-table tbody tr {
    transition: background-color var(--md-sys-motion-duration-short) var(--md-sys-motion-standard);
}

.m3-table tbody tr:hover {
    background: var(--md-sys-state-hover);
}

.m3-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--md-sys-shape-full);
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    font-family: var(--md-ref-typeface-brand);
    font-weight: 700;
    font-size: 14px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

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

.m3-member-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.m3-member-name {
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    display: block;
}

.m3-member-sub {
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
}

.m3-table-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: var(--md-sys-color-surface-container-low);
    border-top: 1px solid var(--md-sys-color-outline-variant);
    font-size: 13px;
    color: var(--md-sys-color-on-surface-variant);
}

/* ---------- Card Grids (Roles & Groups) ---------- */

.m3-grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.m3-role-card {
    background: var(--md-sys-color-surface-container-lowest);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: box-shadow var(--md-sys-motion-duration-short) var(--md-sys-motion-standard),
                border-color var(--md-sys-motion-duration-short) var(--md-sys-motion-standard);
}

.m3-role-card:hover {
    box-shadow: var(--md-sys-elevation-1);
    border-color: var(--md-sys-color-outline);
}

.m3-code-pill {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: var(--md-sys-shape-xs);
    background: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface-variant);
}

/* ---------- Member Detail Layout ---------- */

.m3-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.m3-kv-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 20px;
}

.m3-kv-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--md-sys-color-on-surface-variant);
}

.m3-kv-value {
    margin-top: 2px;
    font-size: 14px;
    color: var(--md-sys-color-on-surface);
    word-break: break-word;
}

.m3-perm-group {
    padding: 12px 14px;
    border-radius: var(--md-sys-shape-md);
    background: var(--md-sys-color-surface-container-low);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.m3-perm-group-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--md-sys-color-on-surface-variant);
}

.m3-checkbox-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--md-sys-shape-sm);
    cursor: pointer;
    transition: background-color var(--md-sys-motion-duration-short) var(--md-sys-motion-standard);
}

.m3-checkbox-item:hover {
    background: var(--md-sys-state-hover);
}

.m3-checkbox-item input[type="checkbox"] {
    margin-top: 2px;
    width: 18px;
    height: 18px;
    accent-color: var(--md-sys-color-primary);
    cursor: pointer;
}

/* ---------- Modal Dialog (Material 3: 28px radius) ---------- */

.m3-dialog-scrim {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: var(--md-sys-color-scrim);
    display: grid;
    place-items: center;
    padding: 20px;
    animation: m3-fade-in 160ms var(--md-sys-motion-standard);
}

.m3-dialog {
    width: 100%;
    max-width: 640px;
    max-height: min(88vh, 820px);
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
    border-radius: var(--md-sys-shape-xl);
    box-shadow: var(--md-sys-elevation-3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: m3-dialog-in 200ms var(--md-sys-motion-standard);
}

.m3-dialog-sm {
    max-width: 440px;
}

.m3-dialog-header {
    padding: 24px 24px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.m3-dialog-title {
    font-size: 22px;
    font-weight: 600;
}

.m3-dialog-body {
    padding: 4px 24px 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.m3-dialog-footer {
    padding: 16px 24px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

@keyframes m3-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes m3-dialog-in {
    from { opacity: 0; transform: translateY(10px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Banner & Empty State ---------- */

.m3-banner {
    padding: 14px 18px;
    border-radius: var(--md-sys-shape-md);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 13px;
}

.m3-banner-error {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

.m3-banner-info {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.m3-empty-state {
    padding: 48px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--md-sys-color-on-surface-variant);
}

.m3-empty-state .material-symbols-rounded {
    font-size: 40px;
    color: var(--md-sys-color-outline);
}

.m3-empty-state h3 {
    font-size: 18px;
    color: var(--md-sys-color-on-surface);
}

/* ---------- Snackbar (M3 Toast) ---------- */

.m3-snackbar-stack {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(420px, calc(100vw - 32px));
}

.m3-snackbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--md-sys-shape-sm);
    background: var(--md-sys-color-inverse-surface);
    color: var(--md-sys-color-inverse-on-surface);
    box-shadow: var(--md-sys-elevation-3);
    font-size: 13px;
    animation: m3-dialog-in 180ms var(--md-sys-motion-standard);
}

.m3-snackbar.error {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

.m3-snackbar button {
    background: transparent;
    border: none;
    color: inherit;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--md-sys-shape-xs);
}

/* ---------- Blazor Error UI ---------- */

#blazor-error-ui {
    display: none;
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 300;
    padding: 12px 18px;
    border-radius: var(--md-sys-shape-md);
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
    box-shadow: var(--md-sys-elevation-3);
    align-items: center;
    gap: 12px;
}

#blazor-error-ui .dismiss {
    margin-left: auto;
    background: transparent;
    border: none;
    color: inherit;
    font-size: 20px;
    cursor: pointer;
}

/* ---------- Responsive Breakpoints ---------- */

.m3-drawer-backdrop {
    display: none;
}

@media (max-width: 960px) {
    .m3-shell {
        grid-template-columns: 1fr;
    }

    .m3-icon-btn.m3-menu-toggle {
        display: inline-flex;
    }

    .m3-topbar-brand {
        display: inline-flex;
    }

    .m3-topbar-subtitle {
        display: none;
    }

    .m3-nav-drawer {
        position: fixed;
        inset: 0 auto 0 0;
        width: 280px;
        transform: translateX(-105%);
        transition: transform var(--md-sys-motion-duration-medium) var(--md-sys-motion-standard);
        box-shadow: var(--md-sys-elevation-3);
    }

    .m3-nav-drawer.open {
        transform: translateX(0);
    }

    .m3-drawer-backdrop.open {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 25;
        background: var(--md-sys-color-scrim);
    }

    .m3-detail-grid {
        grid-template-columns: 1fr;
    }

    .m3-content {
        padding: 20px 16px 48px;
    }
}

@media (max-width: 640px) {
    .m3-form-grid,
    .m3-kv-grid {
        grid-template-columns: 1fr;
    }

    .m3-form-grid .span-2 {
        grid-column: span 1;
    }

    .m3-topbar {
        padding: 0 14px;
    }
}