:root {
    --m-bg: #f4ede4;
    --m-card: #fffdf9;
    --m-text: #332b24;
    --m-muted: #7b6a58;
    --m-primary: #c08c5a;
    --m-primary-hover: #a97848;
    --m-primary-soft: #f8efe3;
    --m-primary-soft-hover: #f2e4d3;
    --m-primary-soft-border: #ead8bf;
    --m-active-bg: #fff7eb;
    --m-border: #e7dac6;
    --m-danger: #b74934;
    --m-warning: #9b6a1e;
    --m-success: #4f7a4d;
}

* {
    box-sizing: border-box;
}

body.member-body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background:
        radial-gradient(circle at top, rgba(212, 165, 116, 0.16), transparent 28%),
        linear-gradient(180deg, #fbf6ef 0%, var(--m-bg) 42%, #f7f1e8 100%);
    color: var(--m-text);
    min-height: 100vh;
}

.member-wrap {
    max-width: 1040px;
    margin: 0 auto;
    padding: 18px 14px 40px;
}

.member-wrap.member-wrap-nav {
    padding-top: 14px;
    padding-bottom: 0;
}

.member-shell-subnav {
    background: rgba(255, 251, 245, 0.9);
    border-bottom: 1px solid rgba(231, 218, 198, 0.8);
    backdrop-filter: blur(10px);
}

.member-card {
    background: var(--m-card);
    border: 1px solid var(--m-border);
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(90, 70, 44, 0.08);
    padding: 22px;
}

.member-auth-card {
    max-width: 460px;
    margin: 32px auto;
}

.member-title {
    margin: 0 0 12px;
    font-size: 22px;
}

.member-subtitle {
    margin: 0 0 18px;
    color: var(--m-muted);
    font-size: 14px;
}

.member-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

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

.member-nav-track {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}

.member-nav-primary,
.member-nav-secondary {
    align-items: center;
}

.member-nav-utility {
    margin-left: auto;
    justify-content: flex-end;
}

.member-nav-spacer {
    flex: 1 1 auto;
    min-width: 0;
}

.member-nav-link {
    text-decoration: none;
    color: var(--m-primary);
    background: var(--m-primary-soft);
    border: 1px solid var(--m-primary-soft-border);
    border-radius: 999px;
    font-size: 13px;
    padding: 8px 13px;
    line-height: 1.2;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.member-nav-link:hover {
    background: var(--m-primary-soft-hover);
}

.member-nav-link.is-primary {
    background: rgba(255, 255, 255, 0.92);
    border-color: var(--m-border);
    color: var(--m-text);
    font-weight: 600;
}

.member-nav-link.is-secondary {
    font-size: 12px;
    padding: 7px 12px;
}

.member-nav-link.is-utility {
    background: #fff;
    border-color: var(--m-border);
    color: #5f5142;
}

.member-nav-link.is-active {
    background: linear-gradient(135deg, #fff8ed 0%, #f6ebd7 100%);
    border-color: #d4a574;
    box-shadow: 0 8px 18px rgba(212, 165, 116, 0.18);
    color: var(--m-text);
}

.member-nav-link.is-utility.is-active {
    border-color: #b98b5a;
}

.member-nav-auth .member-nav-track {
    align-items: center;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

label {
    font-size: 13px;
    color: var(--m-muted);
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    border: 1px solid var(--m-border);
    border-radius: 10px;
    padding: 10px 11px;
    background: #fff;
    color: var(--m-text);
    font-size: 16px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #d4a574;
    box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.16);
}

button,
.btn-link {
    display: inline-block;
    border: 0;
    border-radius: 10px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #d4a574 0%, var(--m-primary) 100%);
    color: #fff;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
}

button:hover,
.btn-link:hover {
    background: var(--m-primary-hover);
    box-shadow: 0 10px 18px rgba(192, 140, 90, 0.2);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #f8f3ec;
    color: var(--m-text);
    border: 1px solid var(--m-border);
}

.btn-secondary:hover {
    background: #efe4d3;
    box-shadow: none;
    transform: none;
}

.btn-danger {
    background: linear-gradient(135deg, #cf6a57 0%, var(--m-danger) 100%);
    color: #fff;
}

.btn-danger:hover {
    background: #b91c1c;
}

.flash {
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 14px;
    font-size: 14px;
}

.flash.success {
    background: #ecfdf3;
    border: 1px solid #bbf7d0;
    color: var(--m-success);
}

.flash.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--m-danger);
}

.flash.warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: var(--m-warning);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.info-item {
    background: #f9fafb;
    border: 1px solid var(--m-border);
    border-radius: 10px;
    padding: 10px 12px;
}

.info-item .label {
    font-size: 12px;
    color: var(--m-muted);
    margin-bottom: 4px;
}

.info-item .value {
    font-size: 15px;
}

.table-wrap {
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
}

th,
td {
    border-bottom: 1px solid var(--m-border);
    text-align: left;
    padding: 10px 8px;
    font-size: 13px;
    vertical-align: top;
}

th {
    color: var(--m-muted);
    font-weight: 600;
    background: #f9fafb;
}

.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1.6;
}

.tag.admin {
    background: #ede9fe;
    color: #6d28d9;
}

.tag.member {
    background: #e0f2fe;
    color: #0369a1;
}

.tag.ok {
    background: #dcfce7;
    color: #166534;
}

.tag.warning {
    background: #fffbeb;
    color: #92400e;
}

.tag.disabled {
    background: #fee2e2;
    color: #991b1b;
}

.inline-form {
    display: inline;
}

.icon-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--m-border);
    background: #fcf4e8;
    color: var(--m-primary);
    text-decoration: none;
    vertical-align: middle;
}

.icon-action:hover {
    background: #f3e5d0;
}

.icon-action.disabled {
    background: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
    border-color: #e5e7eb;
}

.icon-action-svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.profile-table .profile-row {
    cursor: pointer;
}

.profile-table .profile-row:hover {
    background: #fbf5ed;
}

.profile-table .profile-row:focus {
    outline: 2px solid #d4a574;
    outline-offset: -2px;
}

.profile-name-btn {
    background: transparent;
    border: 0;
    color: var(--m-primary);
    padding: 0;
    text-align: left;
    font-weight: 600;
    cursor: pointer;
}

.profile-name-btn:hover {
    text-decoration: underline;
}

.modal-open {
    overflow: hidden;
}

.profile-modal {
    position: fixed;
    inset: 0;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s ease, visibility 0s linear 0.18s;
}

.profile-modal.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.18s ease;
}

.profile-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    transition: opacity 0.18s ease;
}

.profile-modal.open .profile-modal-backdrop {
    opacity: 1;
}

.profile-modal-dialog {
    position: relative;
    z-index: 1;
    margin: 28px auto;
    width: min(920px, calc(100% - 20px));
    max-height: calc(100vh - 56px);
    background: var(--m-card);
    border: 1px solid var(--m-border);
    border-radius: 14px;
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.25);
    display: flex;
    flex-direction: column;
    transform: translateY(8px) scale(0.985);
    transition: transform 0.18s ease;
}

.profile-modal.open .profile-modal-dialog {
    transform: translateY(0) scale(1);
}

.profile-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--m-border);
}

.profile-modal-close {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 1px solid var(--m-border);
    background: #fff;
    color: var(--m-muted);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.profile-modal-close:hover {
    background: #f3f4f6;
}

.profile-modal-close:focus-visible {
    outline: 2px solid #d4a574;
    outline-offset: 2px;
}

.profile-modal-body {
    padding: 14px 16px 16px;
    overflow: auto;
}

.profile-modal-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}

@media (prefers-reduced-motion: reduce) {
    .profile-modal,
    .profile-modal-backdrop,
    .profile-modal-dialog {
        transition: none;
    }
}

.small {
    font-size: 12px;
    color: var(--m-muted);
}

@media (max-width: 760px) {
    .member-nav-row {
        align-items: stretch;
    }

    .member-nav-track {
        flex-wrap: nowrap;
        overflow-x: auto;
        width: 100%;
        padding-bottom: 2px;
        -webkit-overflow-scrolling: touch;
    }

    .member-nav-utility {
        margin-left: 0;
        justify-content: flex-start;
    }

    .member-nav-spacer {
        display: none;
    }

    .member-nav-link {
        flex: 0 0 auto;
    }

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

    .member-card {
        padding: 16px;
    }

    .profile-modal-dialog {
        width: calc(100% - 12px);
        margin: 10px auto;
        max-height: calc(100vh - 20px);
    }

    .profile-modal-body {
        padding: 12px;
    }
}
