:root {
    --bg: #0b0d12;
    --bg-soft: #11151d;
    --panel: rgba(255, 255, 255, 0.075);
    --panel-strong: rgba(255, 255, 255, 0.115);
    --border: rgba(255, 255, 255, 0.12);
    --border-gold: rgba(216, 173, 92, 0.35);
    --gold: #d8ad5c;
    --gold-soft: #9f7a3d;
    --text: #f7efe2;
    --muted: #a8a091;
    --danger: #d35f5f;
    --success: #7ee0a1;
    --shadow: rgba(0, 0, 0, 0.38);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 20% 10%, rgba(216, 173, 92, 0.16), transparent 35%),
        radial-gradient(circle at 80% 0%, rgba(128, 64, 32, 0.18), transparent 35%),
        linear-gradient(135deg, #080a0f 0%, #10141c 52%, #08090d 100%);
    color: var(--text);
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.22;
    background-image:
        linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(circle at center, black, transparent 82%);
}

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

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

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

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 26px;
    background: rgba(255, 255, 255, 0.045);
    border-right: 1px solid var(--border);
    backdrop-filter: blur(22px);
    box-shadow: 20px 0 60px rgba(0,0,0,.22);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 34px;
}

.brand-logo {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    color: #20150a;
    font-weight: 950;
    letter-spacing: -0.08em;
    background:
        linear-gradient(145deg, #f3d486, #b48133);
    box-shadow:
        0 0 0 1px rgba(255,255,255,.25) inset,
        0 12px 28px rgba(216, 173, 92, .16);
}

.brand-logo.large {
    width: 76px;
    height: 76px;
    border-radius: 24px;
    font-size: 1.55rem;
    margin: 0 auto 18px;
}

.brand-text h2 {
    margin: 0;
    line-height: 1;
    font-size: 1.05rem;
    letter-spacing: .04em;
}

.brand-text span {
    color: var(--muted);
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .18em;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 13px 14px;
    border-radius: 15px;
    color: rgba(247, 239, 226, .78);
    transition:
        background .2s ease,
        border-color .2s ease,
        transform .2s ease,
        color .2s ease;
    border: 1px solid transparent;
}

.nav-item:hover {
    color: var(--text);
    background: rgba(255,255,255,.07);
    border-color: rgba(255,255,255,.08);
    transform: translateX(2px);
}

.nav-item.active {
    color: var(--text);
    background:
        linear-gradient(135deg, rgba(216, 173, 92, .18), rgba(255,255,255,.055));
    border-color: var(--border-gold);
    box-shadow: 0 16px 34px rgba(0,0,0,.18);
}

.nav-item.disabled {
    opacity: .45;
}

.main-area {
    min-width: 0;
    padding: 28px;
}

.glass-panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 28px;
    box-shadow: 0 24px 70px var(--shadow);
    backdrop-filter: blur(24px);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
    padding: 18px 20px;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid var(--border);
    border-radius: 24px;
    backdrop-filter: blur(20px);
}

.topbar-title h2 {
    margin: 0;
    font-size: 1.15rem;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: .18em;
    font-size: .72rem;
    font-weight: 800;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-user div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.topbar-user span {
    color: var(--muted);
    font-size: .78rem;
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,.18);
}

.user-avatar-large {
    width: 62px;
    height: 62px;
    border-radius: 18px;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,.18);
}

.ghost-button {
    padding: 10px 13px;
    border-radius: 13px;
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.05);
    color: var(--text);
    cursor: pointer;
}

.ghost-button:hover {
    border-color: var(--border-gold);
    background: rgba(216,173,92,.12);
}

.hero-panel {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 28px;
    margin-bottom: 22px;
    border-color: rgba(216, 173, 92, .24);
}

.hero-panel h1 {
    margin: 0 0 8px;
    font-size: clamp(2rem, 4vw, 3.3rem);
    letter-spacing: -.045em;
}

.muted {
    color: var(--muted);
    line-height: 1.65;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    padding: 11px 14px;
    border-radius: 999px;
    background: rgba(126, 224, 161, .08);
    border: 1px solid rgba(126, 224, 161, .22);
    color: #c9f7d9;
}

.pulse-dot,
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--success);
    box-shadow: 0 0 0 6px rgba(126,224,161,.12);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: rgba(216,173,92,.13);
    border: 1px solid rgba(216,173,92,.22);
    font-size: 1.35rem;
}

.stat-card p {
    margin: 0 0 5px;
    color: var(--muted);
}

.stat-card strong {
    font-size: 1.8rem;
}

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

.info-card {
    padding: 22px;
}

.wide-card {
    grid-column: 1 / -1;
}

.section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 18px;
}

.section-heading h2 {
    margin: 0;
}

.status-list {
    display: grid;
    gap: 10px;
}

.status-row {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 13px 14px;
    border-radius: 15px;
    background: rgba(255,255,255,.045);
    border: 1px solid rgba(255,255,255,.07);
}

.status-row span {
    color: var(--muted);
}

.status-good {
    color: var(--success);
}

.status-bad {
    color: var(--danger);
}

.access-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px;
    border-radius: 18px;
    background: rgba(255,255,255,.045);
    border: 1px solid rgba(255,255,255,.08);
}

.access-card.compact {
    margin: 18px 0;
}

.access-card h3,
.access-card p {
    margin: 0;
}

.role-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.role-chips span {
    padding: 8px 10px;
    border-radius: 999px;
    background: rgba(216,173,92,.10);
    border: 1px solid rgba(216,173,92,.20);
    color: #f4dfb3;
    font-size: .8rem;
}

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

.module-card {
    padding: 16px;
    border-radius: 18px;
    background: rgba(255,255,255,.045);
    border: 1px solid rgba(255,255,255,.08);
}

.module-link {
    display: block;
    transition: transform .2s ease, border-color .2s ease, background .2s ease;
}

.module-link:hover {
    transform: translateY(-2px);
    border-color: var(--border-gold);
    background: rgba(216,173,92,.09);
}

.module-card span {
    display: block;
    font-size: 1.4rem;
    margin-bottom: 10px;
}

.module-card strong {
    display: block;
    margin-bottom: 8px;
}

.module-card p {
    margin: 0;
    color: var(--muted);
    font-size: .9rem;
    line-height: 1.55;
}

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

.form-grid label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: rgba(247,239,226,.86);
    font-weight: 700;
}

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

input,
select,
textarea {
    width: 100%;
    color: var(--text);
    background: rgba(255,255,255,.065);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 15px;
    padding: 13px 14px;
    outline: none;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--border-gold);
    box-shadow: 0 0 0 4px rgba(216,173,92,.10);
}

select option {
    background: #151820;
    color: var(--text);
}

.primary-button {
    justify-self: start;
    padding: 13px 17px;
    border-radius: 15px;
    border: 1px solid rgba(216,173,92,.35);
    background: linear-gradient(135deg, #e3bd68, #9b6d28);
    color: #1e1409;
    font-weight: 900;
    cursor: pointer;
}

.notice {
    margin: 0 0 18px;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,.12);
}

.notice.success {
    color: #d2ffe0;
    background: rgba(126,224,161,.10);
    border-color: rgba(126,224,161,.25);
}

.notice.danger {
    color: #ffd0d0;
    background: rgba(211,95,95,.10);
    border-color: rgba(211,95,95,.32);
}

.footer {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    color: rgba(247,239,226,.45);
    font-size: .8rem;
    padding: 22px 4px 0;
}

.login-body {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 28px;
}

.login-wrapper {
    width: min(480px, 100%);
}

.login-card {
    padding: 34px;
    text-align: center;
    border-color: rgba(216,173,92,.25);
}

.login-card h1 {
    margin: 0 0 14px;
    font-size: 2.25rem;
    letter-spacing: -.04em;
}

.login-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-top: 22px;
    padding: 14px 18px;
    border-radius: 16px;
    border: 1px solid rgba(216,173,92,.35);
    background:
        linear-gradient(135deg, #e3bd68, #9b6d28);
    color: #1e1409;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 18px 40px rgba(216,173,92,.18);
}

.login-note {
    display: block;
    margin-top: 18px;
    color: var(--muted);
    font-size: .85rem;
}

.alert {
    margin-top: 18px;
    padding: 13px;
    border-radius: 16px;
    border: 1px solid rgba(211,95,95,.32);
    background: rgba(211,95,95,.10);
    color: #ffd0d0;
    line-height: 1.55;
}

@media (max-width: 1180px) {
    .stats-grid,
    .module-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

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

    .sidebar {
        position: relative;
        height: auto;
    }

    .topbar,
    .hero-panel {
        flex-direction: column;
        align-items: flex-start;
    }

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

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


.table-wrap {
    overflow-x: auto;
}

.ranking-table {
    width: 100%;
    min-width: 860px;
    border-collapse: collapse;
}

.ranking-table th,
.ranking-table td {
    text-align: left;
    padding: 14px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.ranking-table th {
    color: var(--gold);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .14em;
}

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

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

.player-cell span {
    display: block;
    color: var(--muted);
    font-size: .78rem;
    margin-top: 2px;
}

.mini-avatar {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: rgba(216,173,92,.16);
    border: 1px solid rgba(216,173,92,.24);
    color: #f6d99a;
    font-weight: 900;
}

.level-pill {
    display: inline-flex;
    padding: 7px 10px;
    border-radius: 999px;
    color: #f6d99a;
    background: rgba(216,173,92,.10);
    border: 1px solid rgba(216,173,92,.22);
    font-size: .82rem;
    font-weight: 800;
}

.progress-track {
    width: 180px;
    height: 9px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.08);
    margin-bottom: 6px;
}

.progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #d8ad5c, #f1cf84);
}

.checkbox-label {
    flex-direction: row !important;
    align-items: center;
}

.checkbox-label input {
    width: auto;
}


.welcome-preview {
    display: flex;
    align-items: center;
    gap: 24px;
    min-height: 210px;
    padding: 28px;
    border-radius: 26px;
    border: 1px solid color-mix(in srgb, var(--preview-accent) 38%, transparent);
    background:
        radial-gradient(circle at 15% 35%, color-mix(in srgb, var(--preview-accent) 28%, transparent), transparent 45%),
        linear-gradient(135deg, rgba(255,255,255,.07), rgba(255,255,255,.03));
    overflow: hidden;
}

.welcome-preview-avatar {
    width: 118px;
    height: 118px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: color-mix(in srgb, var(--preview-accent) 86%, #111 14%);
    color: #1e1409;
    font-size: 2rem;
    font-weight: 950;
    box-shadow: 0 20px 50px rgba(0,0,0,.28);
}

.welcome-preview p {
    margin: 0 0 8px;
    color: var(--preview-accent);
    font-weight: 900;
    letter-spacing: .2em;
    font-size: .78rem;
}

.welcome-preview h3 {
    margin: 0 0 8px;
    font-size: clamp(1.6rem, 3vw, 2.5rem);
}

.welcome-preview span {
    color: var(--muted);
}


.panel-list {
    display: grid;
    gap: 18px;
}

.reaction-panel-card {
    padding: 18px;
    border-radius: 22px;
    background: rgba(255,255,255,.045);
    border: 1px solid rgba(255,255,255,.09);
}

.reaction-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 16px;
}

.reaction-panel-head h3 {
    margin: 0 0 7px;
}

.panel-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.primary-button.compact,
.ghost-button.compact {
    padding: 10px 12px;
    border-radius: 13px;
}

.danger-button {
    color: #ffd0d0;
    border-color: rgba(211,95,95,.32);
}

.danger-button:hover {
    background: rgba(211,95,95,.12);
    border-color: rgba(211,95,95,.55);
}

.embed-preview {
    padding: 16px;
    border-radius: 18px;
    background: rgba(0,0,0,.18);
    border-left: 5px solid var(--panel-accent);
    margin-bottom: 14px;
}

.embed-preview strong {
    display: block;
    margin-bottom: 8px;
    font-size: 1.05rem;
}

.embed-preview p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
    white-space: pre-wrap;
}

.reaction-buttons-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-bottom: 16px;
}

.rr-preview-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 0;
    color: #fff;
    border-radius: 10px;
    padding: 9px 12px;
    cursor: pointer;
    font-weight: 800;
}

.rr-secondary {
    background: #4e535b;
}

.rr-primary {
    background: #5865f2;
}

.rr-success {
    background: #3ba55d;
}

.rr-danger {
    background: #ed4245;
}

.sub-form {
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,.08);
}

.empty-state {
    padding: 24px;
    border-radius: 18px;
    background: rgba(255,255,255,.04);
    border: 1px dashed rgba(255,255,255,.14);
    color: var(--muted);
}


.filter-bar {
    display: grid;
    grid-template-columns: 180px 260px minmax(220px, 1fr) auto;
    gap: 12px;
    align-items: end;
    margin-bottom: 18px;
    padding: 14px;
    border-radius: 18px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.08);
}

.filter-bar label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    color: rgba(247,239,226,.86);
    font-weight: 700;
}

.inline-link {
    color: var(--gold);
    font-weight: 800;
}

.detail-close-form {
    margin-top: 18px;
}

.ticket-text-block {
    padding: 16px;
    border-radius: 18px;
    background: rgba(255,255,255,.045);
    border: 1px solid rgba(255,255,255,.08);
    margin-bottom: 14px;
}

.ticket-text-block h3 {
    margin: 0 0 9px;
}

.ticket-text-block p {
    margin: 0;
    color: var(--muted);
    white-space: pre-wrap;
    line-height: 1.65;
}

.ticket-message-list {
    display: grid;
    gap: 12px;
}

.ticket-message {
    padding: 15px;
    border-radius: 18px;
    background: rgba(255,255,255,.045);
    border: 1px solid rgba(255,255,255,.08);
}

.ticket-message.system-message {
    background: rgba(216,173,92,.08);
    border-color: rgba(216,173,92,.22);
}

.ticket-message-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 8px;
}

.ticket-message-head span,
.ticket-message small {
    color: var(--muted);
    font-size: .8rem;
}

.ticket-message p {
    margin: 0;
    color: rgba(247,239,226,.9);
    white-space: pre-wrap;
    line-height: 1.6;
}

@media (max-width: 980px) {
    .filter-bar {
        grid-template-columns: 1fr;
    }
}


.rich-author {
    align-items: center;
    justify-content: flex-start;
}

.ticket-avatar {
    width: 44px;
    height: 44px;
    border-radius: 15px;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,.16);
    flex: 0 0 auto;
}

.ticket-author-main {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ticket-author-main strong span {
    color: var(--muted);
    font-weight: 700;
    margin-left: 5px;
}

.ticket-content a,
.ticket-link-list a,
.ticket-file-card,
.ticket-link-embed {
    color: var(--gold);
    font-weight: 800;
    word-break: break-word;
}

.ticket-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.ticket-media-card,
.ticket-file-card {
    display: block;
    border-radius: 18px;
    background: rgba(255,255,255,.045);
    border: 1px solid rgba(255,255,255,.10);
    overflow: hidden;
}

.ticket-media-card img,
.ticket-media-card video {
    width: 100%;
    max-height: 360px;
    display: block;
    object-fit: cover;
    background: rgba(0,0,0,.25);
}

.ticket-media-card span,
.ticket-media-card a {
    display: block;
    padding: 10px 12px;
    color: var(--muted);
    font-size: .85rem;
}

.ticket-file-card {
    padding: 13px 14px;
}

.ticket-embed-list {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.ticket-link-embed {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 18px;
    background: rgba(216,173,92,.08);
    border: 1px solid rgba(216,173,92,.18);
    color: var(--text);
}

.ticket-link-embed img {
    width: 96px;
    height: 76px;
    border-radius: 12px;
    object-fit: cover;
    flex: 0 0 auto;
}

.ticket-link-embed small {
    display: block;
    color: var(--gold);
    margin-bottom: 4px;
}

.ticket-link-embed strong {
    display: block;
    margin-bottom: 4px;
}

.ticket-link-embed p {
    margin: 0 0 5px;
    color: var(--muted);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ticket-link-embed span {
    display: block;
    color: var(--muted);
    font-size: .78rem;
    word-break: break-word;
}

.ticket-link-list {
    display: grid;
    gap: 6px;
    margin-top: 12px;
}


.info-notice {
    color: #e8d5ad;
    background: rgba(216,173,92,.08);
    border-color: rgba(216,173,92,.24);
}

.inline-delete-form {
    margin-top: 14px;
}


/* Westmark Assistant UI Cleanup */
html {
    scrollbar-width: thin;
    scrollbar-color: rgba(216, 173, 92, .75) rgba(255, 255, 255, .045);
}

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(216, 173, 92, .75) rgba(255, 255, 255, .045);
}

*::-webkit-scrollbar {
    width: 11px;
    height: 11px;
}

*::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, .045);
    border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
    background:
        linear-gradient(180deg, rgba(216, 173, 92, .95), rgba(151, 104, 38, .9));
    border: 2px solid rgba(12, 14, 19, .9);
    border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
    background:
        linear-gradient(180deg, rgba(241, 207, 132, 1), rgba(184, 129, 46, 1));
}

select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 44px;
    background-image:
        linear-gradient(45deg, transparent 50%, #d8ad5c 50%),
        linear-gradient(135deg, #d8ad5c 50%, transparent 50%),
        linear-gradient(135deg, rgba(216,173,92,.18), rgba(255,255,255,.035));
    background-position:
        calc(100% - 23px) 50%,
        calc(100% - 16px) 50%,
        100% 0;
    background-size:
        7px 7px,
        7px 7px,
        42px 100%;
    background-repeat: no-repeat;
}

select:hover {
    border-color: rgba(216, 173, 92, .32);
}

select option {
    background: #151820;
    color: var(--text);
}

.accordion-stack {
    display: grid;
    gap: 18px;
}

.accordion-card {
    padding: 0;
    overflow: hidden;
}

.accordion-card > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 22px;
    user-select: none;
}

.accordion-card > summary::-webkit-details-marker {
    display: none;
}

.accordion-card > summary h2 {
    margin: 0;
}

.accordion-card > summary:hover {
    background: rgba(216, 173, 92, .06);
}

.accordion-chevron {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(216,173,92,.12);
    border: 1px solid rgba(216,173,92,.22);
    color: var(--gold);
    font-weight: 900;
    transition: transform .18s ease, background .18s ease;
}

.accordion-card[open] .accordion-chevron {
    transform: rotate(180deg);
}

.accordion-content {
    padding: 0 22px 22px;
}

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

@media (max-width: 980px) {
    .dashboard-grid-clean {
        grid-template-columns: 1fr;
    }
}


/* Westmark Assistant Live + Global Accordions */
.live-badge {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 9999;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 10px 13px;
    border-radius: 999px;
    color: rgba(247,239,226,.78);
    background: rgba(255,255,255,.065);
    border: 1px solid rgba(255,255,255,.12);
    box-shadow: 0 14px 40px rgba(0,0,0,.32);
    backdrop-filter: blur(18px);
    font-size: .82rem;
    font-weight: 800;
}

.live-badge span {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #d35f5f;
    box-shadow: 0 0 0 5px rgba(211,95,95,.12);
}

.live-badge.is-live span {
    background: #7ee0a1;
    box-shadow: 0 0 0 5px rgba(126,224,161,.12);
}

.live-toast {
    position: fixed;
    right: 22px;
    bottom: 72px;
    z-index: 9999;
    max-width: 340px;
    padding: 12px 14px;
    border-radius: 16px;
    color: #f7efe2;
    background: rgba(20, 24, 33, .88);
    border: 1px solid rgba(216,173,92,.26);
    box-shadow: 0 18px 50px rgba(0,0,0,.42);
    backdrop-filter: blur(18px);
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
}

.live-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.accordion-card.wide-card {
    grid-column: 1 / -1;
}

.accordion-card .section-heading {
    margin-bottom: 0;
}

.accordion-card .accordion-content > .section-heading:first-child {
    display: none;
}

.dashboard-grid .accordion-card {
    min-width: 0;
}

.dashboard-grid-clean .accordion-card {
    min-width: 0;
}


/* Westmark Assistant Dashboard plain + persistent accordions */
.dashboard-grid-clean > .info-card {
    min-width: 0;
}

details.accordion-card {
    transition: border-color .18s ease, background .18s ease;
}

details.accordion-card:not([open]) {
    background: rgba(255,255,255,.055);
}

details.accordion-card:not([open]) > summary {
    border-radius: 28px;
}


/* Westmark Assistant Brand asset + ranking member profiles */
.brand-logo-image {
    overflow: hidden;
    padding: 0;
    background: rgba(216,173,92,.12);
}

.brand-logo-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: inherit;
}

.player-cell-rich .ranking-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,.16);
    background: rgba(255,255,255,.06);
    flex: 0 0 auto;
}

.player-cell-rich strong span {
    color: var(--muted);
    font-weight: 700;
    margin-left: 5px;
}


/* Westmark Assistant Ranking profile fix */
.player-cell-rich {
    align-items: center;
}

.player-cell-rich .ranking-avatar,
.ranking-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,.16);
    background: rgba(255,255,255,.06);
    flex: 0 0 auto;
}

.player-cell-rich strong span {
    color: var(--muted);
    font-weight: 700;
    margin-left: 5px;
}


/* Westmark Assistant Login icon asset without frame/background */
.login-logo-asset {
    width: 96px;
    height: 96px;
    margin: 0 auto 18px;
    display: grid;
    place-items: center;
    background: transparent;
    border: 0;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
}

.login-logo-asset img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: transparent;
    border: 0;
    box-shadow: none;
}


/* Westmark Assistant Sidebar top-left icon asset without frame/background */
.sidebar .brand-logo.brand-logo-image,
.brand-logo.brand-logo-image,
.brand-logo-image {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
}

.sidebar .brand-logo.brand-logo-image img,
.brand-logo.brand-logo-image img,
.brand-logo-image img {
    width: 100%;
    height: 100%;
    object-fit: contain !important;
    display: block;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
}


/* Westmark Assistant Voice System */
.voice-hint {
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(216,173,92,.08);
    border: 1px solid rgba(216,173,92,.2);
    color: var(--muted);
}




/* Bot runtime footer */
#bot-runtime-footer {
    color: var(--muted);
    font-weight: 700;
    text-align: right;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
}

#bot-runtime-footer span {
    display: block;
}


/* Footer only last update */
#bot-runtime-footer {
    color: var(--muted);
    font-weight: 700;
    text-align: right;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 0;
}

#bot-runtime-footer span {
    display: inline;
}


/* Westmark icon asset layout cleanup */
.live-badge {
    display: none !important;
}

.nav-item {
    min-height: 46px;
    display: flex;
    align-items: center;
}

.nav-icon {
    width: 22px;
    height: 22px;
    min-width: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nav-icon img {
    width: 22px;
    height: 22px;
    display: block;
    object-fit: contain;
}

.stat-icon {
    font-size: 0 !important;
}

.stat-icon img {
    width: 28px;
    height: 28px;
    display: block;
    object-fit: contain;
}

.inline-ui-icon {
    width: 17px;
    height: 17px;
    display: inline-block;
    vertical-align: -3px;
    margin-right: 6px;
}

.button-inline-icon {
    width: 14px;
    height: 14px;
    display: inline-block;
    vertical-align: -2px;
    margin-left: 6px;
}

.reaction-panel-head,
.panel-actions {
    align-items: center;
}


/* Sidebar category navigation */
.nav {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.nav-section {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.nav-section > span {
    display: block;
    padding: 0 14px;
    color: rgba(216, 173, 92, .86);
    font-size: .68rem;
    font-weight: 900;
    letter-spacing: .16em;
    text-transform: uppercase;
    line-height: 1;
}

.nav-item {
    min-height: 46px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-label {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    line-height: 1.2;
}

.nav-icon {
    width: 22px;
    height: 22px;
    min-width: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nav-icon img {
    width: 22px;
    height: 22px;
    display: block;
    object-fit: contain;
}

.nav-section + .nav-section {
    margin-top: 2px;
}


/* Accordion chevron as asset */
.accordion-chevron {
    width: 34px;
    height: 34px;
    min-width: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(216, 173, 92, .08);
    border: 1px solid rgba(216, 173, 92, .18);
    box-shadow: none;
    line-height: 1;
}

.accordion-chevron img {
    width: 20px;
    height: 20px;
    display: block;
    object-fit: contain;
    transition: transform .18s ease;
    transform: rotate(-90deg);
}

details[open] > summary .accordion-chevron img {
    transform: rotate(0deg);
}

details.accordion-card > summary {
    align-items: center;
}

details.accordion-card > summary::-webkit-details-marker {
    display: none;
}

details.accordion-card > summary::marker {
    content: "";
}


/* Global Westmark scrollbars + arrow controls */
:root {
    scrollbar-width: thin;
    scrollbar-color: rgba(216, 173, 92, .58) rgba(255, 255, 255, .045);
}

/* Chromium / Edge fallback */
*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, .045);
    border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
    background:
        linear-gradient(180deg, rgba(216, 173, 92, .78), rgba(130, 93, 36, .78));
    border: 2px solid rgba(15, 17, 23, .86);
    border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
    background:
        linear-gradient(180deg, rgba(245, 204, 122, .95), rgba(170, 121, 48, .9));
}

*::-webkit-scrollbar-corner {
    background: rgba(15, 17, 23, .86);
}

.sidebar,
.main-area,
.table-wrap,
.ticket-thread,
.ticket-message-list,
.panel-list,
.accordion-content,
textarea,
select {
    scrollbar-width: thin;
    scrollbar-color: rgba(216, 173, 92, .62) rgba(255, 255, 255, .045);
}

/* Select dropdown arrow as asset */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image:
        linear-gradient(135deg, rgba(255,255,255,.065), rgba(255,255,255,.025)),
        url("/assets/icons/select_chevron.svg") !important;
    background-repeat: no-repeat, no-repeat !important;
    background-position: left top, right 14px center !important;
    background-size: auto, 18px 18px !important;
    padding-right: 46px !important;
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: rgba(216, 173, 92, .52) !important;
    box-shadow: 0 0 0 4px rgba(216, 173, 92, .10);
}

/* Hide old native details markers */
details > summary::-webkit-details-marker {
    display: none;
}

details > summary::marker {
    content: "";
}

/* Accordion chevron as SVG asset */
.accordion-chevron {
    width: 34px;
    height: 34px;
    min-width: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background:
        linear-gradient(135deg, rgba(216, 173, 92, .12), rgba(255,255,255,.025));
    border: 1px solid rgba(216, 173, 92, .20);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
    line-height: 1;
}

.accordion-chevron img {
    width: 20px;
    height: 20px;
    display: block;
    object-fit: contain;
    transition: transform .18s ease;
    transform: rotate(-90deg);
}

details[open] > summary .accordion-chevron img {
    transform: rotate(0deg);
}

details.accordion-card > summary {
    align-items: center;
    cursor: pointer;
}

/* Tables and horizontal scroll areas stay in the same design */
.table-wrap {
    overflow: auto;
    border-radius: 18px;
}

.table-wrap table {
    min-width: 760px;
}

.ticket-thread,
.ticket-message-list,
.panel-list {
    overflow: auto;
}

/* Number inputs: remove ugly native spin buttons where possible */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    opacity: .55;
    filter: sepia(1) saturate(1.3) hue-rotate(352deg);
}


/* Westmark styled checkboxes and radio controls */
input[type="checkbox"],
input[type="radio"] {
    accent-color: #d8ad5c;
}

@supports (appearance: none) {
    input[type="checkbox"],
    input[type="radio"] {
        appearance: none;
        -webkit-appearance: none;
        width: 21px;
        height: 21px;
        min-width: 21px;
        margin: 0;
        display: inline-grid;
        place-items: center;
        vertical-align: middle;
        cursor: pointer;
        background:
            linear-gradient(135deg, rgba(216, 173, 92, .10), rgba(255,255,255,.035));
        border: 1px solid rgba(216, 173, 92, .38);
        box-shadow:
            inset 0 1px 0 rgba(255,255,255,.055),
            0 10px 24px rgba(0,0,0,.18);
        transition:
            background .18s ease,
            border-color .18s ease,
            box-shadow .18s ease,
            transform .18s ease;
    }

    input[type="checkbox"] {
        border-radius: 7px;
        background-repeat: no-repeat;
        background-position: center;
        background-size: 15px 15px;
    }

    input[type="radio"] {
        border-radius: 999px;
        background-repeat: no-repeat;
        background-position: center;
        background-size: 11px 11px;
    }

    input[type="checkbox"]:hover,
    input[type="radio"]:hover {
        border-color: rgba(245, 204, 122, .72);
        background:
            linear-gradient(135deg, rgba(216, 173, 92, .16), rgba(255,255,255,.055));
    }

    input[type="checkbox"]:focus-visible,
    input[type="radio"]:focus-visible {
        outline: none;
        border-color: rgba(245, 204, 122, .86);
        box-shadow:
            0 0 0 4px rgba(216, 173, 92, .14),
            0 14px 30px rgba(0,0,0,.26);
    }

    input[type="checkbox"]:checked {
        background-color: #d8ad5c;
        background-image:
            linear-gradient(135deg, rgba(245, 204, 122, .92), rgba(167, 116, 42, .92)),
            url("/assets/icons/checkbox_check.svg");
        background-repeat: no-repeat, no-repeat;
        background-position: center, center;
        background-size: auto, 15px 15px;
        border-color: rgba(245, 204, 122, .96);
    }

    input[type="radio"]:checked {
        background-color: #d8ad5c;
        background-image:
            linear-gradient(135deg, rgba(245, 204, 122, .92), rgba(167, 116, 42, .92)),
            url("/assets/icons/radio_dot.svg");
        background-repeat: no-repeat, no-repeat;
        background-position: center, center;
        background-size: auto, 11px 11px;
        border-color: rgba(245, 204, 122, .96);
    }

    input[type="checkbox"]:disabled,
    input[type="radio"]:disabled {
        opacity: .42;
        cursor: not-allowed;
        filter: grayscale(.35);
    }
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 34px;
    color: rgba(247, 239, 226, .88);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"],
.checkbox-label input[type="radio"] {
    flex: 0 0 auto;
}

.checkbox-label.full {
    width: 100%;
}


/* Ranking 7-day placement delta */
.rank-delta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 58px;
    height: 30px;
    padding: 0 9px;
    border-radius: 999px;
    font-weight: 900;
    font-size: .82rem;
    line-height: 1;
    border: 1px solid transparent;
}

.rank-delta img {
    width: 18px;
    height: 18px;
    display: block;
    object-fit: contain;
}

.rank-delta-up {
    color: #7ee0a1;
    background: rgba(126, 224, 161, .10);
    border-color: rgba(126, 224, 161, .28);
}

.rank-delta-down {
    color: #d35f5f;
    background: rgba(211, 95, 95, .10);
    border-color: rgba(211, 95, 95, .30);
}


/* Members module */
.members-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.member-card {
    padding: 18px;
    border-radius: 22px;
    background:
        linear-gradient(135deg, rgba(255,255,255,.075), rgba(255,255,255,.028));
    border: 1px solid rgba(255,255,255,.11);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.045),
        0 18px 45px rgba(0,0,0,.18);
}

.member-main {
    display: flex;
    align-items: center;
    gap: 14px;
}

.member-avatar {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    object-fit: cover;
    border: 2px solid rgba(216, 173, 92, .48);
    box-shadow: 0 12px 26px rgba(0,0,0,.26);
}

.member-identity {
    min-width: 0;
}

.member-identity h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: #f7efe2;
    font-size: 1.03rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.member-identity p {
    margin: 4px 0 0;
    color: rgba(247, 239, 226, .66);
    font-weight: 700;
}

.member-id {
    display: block;
    margin-top: 3px;
    color: rgba(247, 239, 226, .38);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .04em;
}

.member-bot-pill {
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(216, 173, 92, .12);
    border: 1px solid rgba(216, 173, 92, .28);
    color: #d8ad5c;
    font-size: .68rem;
    font-weight: 900;
    text-transform: uppercase;
}

.member-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
    margin-top: 14px;
}

.member-meta span {
    padding: 10px;
    border-radius: 14px;
    background: rgba(0,0,0,.16);
    border: 1px solid rgba(255,255,255,.07);
    color: rgba(247, 239, 226, .55);
    font-size: .78rem;
    font-weight: 800;
}

.member-meta strong {
    display: block;
    margin-top: 3px;
    color: rgba(247, 239, 226, .88);
}

.member-roles {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 14px;
}

.role-chip {
    --role-color: #d8ad5c;
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 9px;
    border-radius: 999px;
    color: rgba(247, 239, 226, .88);
    background: color-mix(in srgb, var(--role-color) 18%, transparent);
    border: 1px solid color-mix(in srgb, var(--role-color) 42%, transparent);
    font-size: .76rem;
    font-weight: 900;
}

.muted-role {
    --role-color: #7d7668;
    color: rgba(247, 239, 226, .46);
}


/* Member profile / cases / admin */
.member-card-clickable {
    cursor: pointer;
    transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.member-card-clickable:hover {
    transform: translateY(-2px);
    border-color: rgba(216, 173, 92, .28);
    background:
        linear-gradient(135deg, rgba(216,173,92,.085), rgba(255,255,255,.035));
}

.member-open-link {
    display: inline-flex;
    margin-top: 14px;
    color: #d8ad5c;
    font-weight: 900;
    text-decoration: none;
}

.member-profile-hero {
    align-items: center;
}

.member-profile-head {
    display: flex;
    align-items: center;
    gap: 18px;
}

.member-profile-avatar {
    width: 92px;
    height: 92px;
    border-radius: 26px;
    object-fit: cover;
    border: 3px solid rgba(216, 173, 92, .56);
    box-shadow: 0 18px 42px rgba(0,0,0,.32);
}

.member-profile-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.member-info-box {
    padding: 16px;
    border-radius: 18px;
    background: rgba(0,0,0,.16);
    border: 1px solid rgba(255,255,255,.08);
}

.member-info-box span {
    display: block;
    color: rgba(247,239,226,.50);
    font-size: .75rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.member-info-box strong {
    display: block;
    margin-top: 7px;
    color: rgba(247,239,226,.92);
    font-size: .95rem;
    word-break: break-word;
}

.member-detail-roles {
    margin-top: 16px;
}

.case-list {
    display: grid;
    gap: 14px;
}

.case-card {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 18px;
    border-radius: 20px;
    background: rgba(255,255,255,.055);
    border: 1px solid rgba(255,255,255,.10);
}

.case-card h3 {
    margin: 0 0 8px;
    color: #f7efe2;
}

.case-card p {
    margin: 0 0 10px;
    color: rgba(247,239,226,.72);
    white-space: pre-wrap;
}

.case-card span {
    color: rgba(247,239,226,.45);
    font-size: .78rem;
    font-weight: 800;
}

.case-severity-hoch,
.case-severity-kritisch {
    border-color: rgba(211, 95, 95, .32);
}

.case-severity-niedrig {
    border-color: rgba(126, 224, 161, .24);
}

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

.member-admin-box {
    padding: 18px;
    border-radius: 20px;
    background: rgba(0,0,0,.14);
    border: 1px solid rgba(255,255,255,.08);
}

.member-admin-box h3 {
    margin: 0 0 14px;
    color: #f7efe2;
}

.member-admin-box label {
    display: block;
    margin-bottom: 12px;
}

.danger-zone {
    border-color: rgba(211,95,95,.25);
    background: rgba(211,95,95,.055);
}

button:disabled,
.primary-button:disabled,
.ghost-button:disabled {
    opacity: .42;
    cursor: not-allowed;
    pointer-events: none;
}

@media (max-width: 1200px) {
    .member-profile-grid,
    .admin-action-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 760px) {
    .member-profile-grid,
    .admin-action-grid {
        grid-template-columns: 1fr;
    }

    .case-card {
        flex-direction: column;
    }
}


/* v11 moderation/audit additions */
.member-inline-check {
    align-self: end;
    padding: 12px 0;
}

.audit-log-list {
    display: grid;
    gap: 10px;
}

.audit-log-row {
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(0,0,0,.16);
    border: 1px solid rgba(255,255,255,.08);
}

.audit-log-row strong {
    color: #f7efe2;
}

.audit-log-row span {
    color: rgba(247,239,226,.48);
    font-size: .78rem;
    font-weight: 800;
}


/* v11 DM chat cleanup */
.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.dm-unread-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 0 9px;
    margin-left: 8px;
    border-radius: 999px;
    background: rgba(211, 95, 95, .16);
    border: 1px solid rgba(211, 95, 95, .34);
    color: #ff9c9c;
    font-size: .72rem;
    font-weight: 900;
    vertical-align: middle;
}

.dm-chat-window {
    display: grid;
    gap: 14px;
    max-height: 680px;
    overflow: auto;
    padding-right: 8px;
}

.dm-message {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}

.dm-avatar {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    object-fit: cover;
    border: 2px solid rgba(216, 173, 92, .38);
    box-shadow: 0 10px 22px rgba(0,0,0,.25);
}

.dm-bubble {
    padding: 14px;
    border-radius: 18px;
    background: rgba(255,255,255,.055);
    border: 1px solid rgba(255,255,255,.10);
}

.dm-message-outbound .dm-bubble,
.dm-message-auto .dm-bubble {
    background: rgba(216,173,92,.08);
    border-color: rgba(216,173,92,.18);
}

.dm-author {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: baseline;
    margin-bottom: 8px;
}

.dm-author strong {
    color: #f7efe2;
}

.dm-author span {
    color: rgba(247,239,226,.46);
    font-size: .78rem;
    font-weight: 800;
}

.dm-bubble p {
    margin: 0;
    color: rgba(247,239,226,.78);
    line-height: 1.55;
    white-space: normal;
    word-break: break-word;
}

.dm-bubble a {
    color: #d8ad5c;
    font-weight: 900;
}

.dm-attachments,
.dm-embeds {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.dm-image {
    max-width: min(520px, 100%);
    max-height: 360px;
    border-radius: 16px;
    border: 1px solid rgba(216,173,92,.24);
    object-fit: contain;
    background: rgba(0,0,0,.20);
}

.dm-video {
    max-width: min(560px, 100%);
    border-radius: 16px;
    border: 1px solid rgba(216,173,92,.24);
    background: rgba(0,0,0,.26);
}

.dm-file,
.dm-embed {
    display: block;
    padding: 12px;
    border-radius: 15px;
    background: rgba(0,0,0,.18);
    border: 1px solid rgba(255,255,255,.08);
}

.dm-thumbnail {
    max-width: 160px;
    border-radius: 12px;
    border: 1px solid rgba(216,173,92,.20);
}

.dm-unread-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #ff9c9c;
    font-size: .78rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .12em;
}

.dm-unread-divider::before,
.dm-unread-divider::after {
    content: "";
    height: 1px;
    flex: 1;
    background: rgba(211,95,95,.38);
}


/* Members card bottom action + highest-role name color + sticky dashboard footer */
.main-area {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.footer {
    margin-top: auto;
}

.members-grid {
    align-items: stretch;
}

.member-card {
    display: flex;
    flex-direction: column;
    min-height: 260px;
}

.member-card .member-main,
.member-card .member-meta,
.member-card .member-roles {
    flex: 0 0 auto;
}

.member-card .member-open-link {
    margin-top: auto;
    padding-top: 16px;
    align-self: flex-start;
}

.member-name-rolecolor {
    color: var(--member-role-color, #f7efe2);
    text-shadow: 0 0 18px color-mix(in srgb, var(--member-role-color, #d8ad5c) 22%, transparent);
}


/* Member profile highest-role name color */
.member-profile-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.member-profile-name-rolecolor {
    color: var(--member-role-color, #f7efe2);
    text-shadow: 0 0 20px color-mix(in srgb, var(--member-role-color, #d8ad5c) 24%, transparent);
}

.member-profile-highest-role {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    color: rgba(247, 239, 226, .92);
    background: color-mix(in srgb, var(--member-role-color, #d8ad5c) 20%, transparent);
    border: 1px solid color-mix(in srgb, var(--member-role-color, #d8ad5c) 46%, transparent);
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .02em;
    transform: translateY(2px);
}


/* Smooth iPhone-like UI motion/performance pass */
:root {
    --wm-ease-out: cubic-bezier(.2, .8, .2, 1);
    --wm-ease-spring: cubic-bezier(.22, 1, .36, 1);
    --wm-motion-fast: 140ms;
    --wm-motion-medium: 240ms;
    --wm-motion-slow: 420ms;
    --wm-press-scale: .985;
}

html {
    scroll-behavior: smooth;
}

body {
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.main-area {
    animation: wm-page-enter var(--wm-motion-slow) var(--wm-ease-out) both;
    transform-origin: 50% 24px;
}

@keyframes wm-page-enter {
    from {
        opacity: .74;
        transform: translate3d(0, 10px, 0) scale(.994);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

.glass-panel,
.stat-card,
.member-card,
.ticket-card,
.case-card,
.member-admin-box,
.audit-log-row,
.nav-item,
.primary-button,
.ghost-button,
button,
input,
select,
textarea,
.role-chip {
    transition:
        transform var(--wm-motion-medium) var(--wm-ease-spring),
        opacity var(--wm-motion-medium) var(--wm-ease-out),
        border-color var(--wm-motion-medium) var(--wm-ease-out),
        background-color var(--wm-motion-medium) var(--wm-ease-out),
        box-shadow var(--wm-motion-medium) var(--wm-ease-out),
        filter var(--wm-motion-medium) var(--wm-ease-out);
}

.glass-panel,
.stat-card,
.member-card,
.ticket-card,
.case-card,
.member-admin-box,
.audit-log-row {
    backface-visibility: hidden;
    transform: translateZ(0);
    contain: layout paint;
}

.glass-panel:hover,
.stat-card:hover,
.member-card:hover,
.ticket-card:hover,
.case-card:hover,
.member-admin-box:hover,
.audit-log-row:hover {
    transform: translate3d(0, -2px, 0);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.055),
        0 24px 52px rgba(0,0,0,.24);
}

.nav-item {
    transform: translateZ(0);
}

.nav-item:hover {
    transform: translate3d(4px, 0, 0);
}

.nav-item.active {
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.06),
        0 14px 30px rgba(0,0,0,.24);
}

.primary-button,
.ghost-button,
button {
    transform: translateZ(0);
    position: relative;
    overflow: hidden;
}

.primary-button:hover,
.ghost-button:hover,
button:hover {
    transform: translate3d(0, -1px, 0);
    filter: brightness(1.05);
}

.primary-button:active,
.ghost-button:active,
button:active,
.nav-item:active,
.member-card-clickable:active {
    transform: scale(var(--wm-press-scale));
}

input:focus,
select:focus,
textarea:focus {
    transform: translate3d(0, -1px, 0);
    box-shadow:
        0 0 0 1px rgba(216,173,92,.34),
        0 0 0 5px rgba(216,173,92,.08),
        inset 0 1px 0 rgba(255,255,255,.05);
}

details.accordion-card {
    overflow: hidden;
}

details.accordion-card > summary {
    transition:
        background-color var(--wm-motion-medium) var(--wm-ease-out),
        transform var(--wm-motion-medium) var(--wm-ease-spring);
}

details.accordion-card > summary:hover {
    transform: translate3d(0, -1px, 0);
}

details.accordion-card .accordion-content {
    animation: wm-accordion-open var(--wm-motion-medium) var(--wm-ease-out) both;
    transform-origin: top center;
}

@keyframes wm-accordion-open {
    from {
        opacity: .62;
        transform: translate3d(0, -6px, 0) scaleY(.985);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0) scaleY(1);
    }
}

.accordion-chevron img,
.accordion-chevron {
    transition: transform var(--wm-motion-medium) var(--wm-ease-spring), opacity var(--wm-motion-medium) var(--wm-ease-out);
}

details[open] .accordion-chevron,
details[open] .accordion-chevron img {
    transform: rotate(180deg);
}

.members-grid,
.dashboard-grid,
.stats-grid,
.ticket-list,
.case-list,
.audit-log-list {
    content-visibility: auto;
    contain-intrinsic-size: 1px 900px;
}

.member-card,
.stat-card,
.glass-panel {
    will-change: auto;
}

.member-card:hover,
.stat-card:hover,
.nav-item:hover,
.primary-button:hover,
.ghost-button:hover {
    will-change: transform;
}

.role-chip:hover,
.member-profile-highest-role:hover,
.member-bot-pill:hover {
    transform: translate3d(0, -1px, 0) scale(1.015);
}

.dm-chat-window,
.main-area {
    overscroll-behavior: contain;
}

.dm-message,
.member-card,
.case-card,
.audit-log-row {
    animation: wm-soft-item-in var(--wm-motion-slow) var(--wm-ease-out) both;
}

@keyframes wm-soft-item-in {
    from {
        opacity: .72;
        transform: translate3d(0, 8px, 0);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: .001ms !important;
    }

    .main-area,
    .dm-message,
    .member-card,
    .case-card,
    .audit-log-row {
        transform: none !important;
    }
}


/* Unread DMs + former members overview */
.dashboard-unread-dms,
.members-unread-dms,
.former-members-panel {
    padding: 20px;
    margin-bottom: 18px;
}

.unread-dm-list,
.former-member-list {
    display: grid;
    gap: 12px;
}

.unread-dm-list.compact {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.unread-dm-row,
.former-member-row {
    border-radius: 18px;
    background: rgba(0,0,0,.16);
    border: 1px solid rgba(255,255,255,.08);
    transition:
        transform var(--wm-motion-medium, 240ms) var(--wm-ease-spring, cubic-bezier(.22,1,.36,1)),
        border-color var(--wm-motion-medium, 240ms) var(--wm-ease-out, cubic-bezier(.2,.8,.2,1)),
        background-color var(--wm-motion-medium, 240ms) var(--wm-ease-out, cubic-bezier(.2,.8,.2,1));
}

.unread-dm-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    color: inherit;
    text-decoration: none;
}

.unread-dm-row:hover,
.former-member-row:hover {
    transform: translate3d(0, -2px, 0);
    border-color: rgba(216,173,92,.30);
    background: rgba(216,173,92,.07);
}

.unread-dm-row img,
.former-member-head img {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    object-fit: cover;
    border: 2px solid rgba(216,173,92,.35);
}

.unread-dm-row strong,
.former-member-head strong {
    display: block;
    color: #f7efe2;
}

.unread-dm-row span,
.former-member-head span {
    display: block;
    color: rgba(247,239,226,.55);
    font-size: .78rem;
    font-weight: 800;
    margin-top: 2px;
}

.former-member-row {
    padding: 14px;
}

.former-member-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.former-member-roles {
    margin-top: 12px;
}

.former-member-form {
    display: grid;
    grid-template-columns: 180px minmax(220px, 1fr) auto;
    gap: 10px;
    align-items: end;
    margin-top: 12px;
}

.former-member-form label {
    margin: 0;
}

.former-member-form .full {
    min-width: 0;
}

.member-profile-unread-dm {
    text-decoration: none;
}

@media (max-width: 900px) {
    .former-member-form {
        grid-template-columns: 1fr;
    }
}


/* Role colored names/chips for dashboard + DM chat */
.role-colored-name,
.member-profile-name-rolecolor,
.dm-author-name {
    color: var(--member-role-color, #f7efe2);
    text-shadow: 0 0 20px color-mix(in srgb, var(--member-role-color, #d8ad5c) 24%, transparent);
}

.member-profile-title,
.dashboard-user-title,
.dashboard-user-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.member-profile-highest-role,
.dashboard-highest-role-chip,
.dm-author-role {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    color: rgba(247, 239, 226, .92);
    background: color-mix(in srgb, var(--member-role-color, #d8ad5c) 20%, transparent);
    border: 1px solid color-mix(in srgb, var(--member-role-color, #d8ad5c) 46%, transparent);
    font-size: .76rem;
    font-weight: 900;
    letter-spacing: .02em;
}

.dashboard-role-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
}

.dashboard-role-chip-row .colored-role-chip,
.role-chips .colored-role-chip {
    --chip-color: var(--role-color, #d8ad5c);
    color: rgba(247,239,226,.92);
    background: color-mix(in srgb, var(--chip-color) 17%, transparent);
    border: 1px solid color-mix(in srgb, var(--chip-color) 42%, transparent);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.045);
}

.unread-dm-row > div {
    min-width: 0;
}

.unread-dm-row .dashboard-role-chip-row {
    margin-top: 7px;
}

.dm-author {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.dm-author-name {
    font-weight: 950;
}

.dm-author-role {
    min-height: 22px;
    padding: 0 8px;
    font-size: .68rem;
}

/* Keep 5 stat cards in one row where width allows */
.stats-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: stretch;
}

.stats-grid .stat-card {
    min-width: 0;
}

.stats-grid .stat-card strong,
.stats-grid .stat-card p {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 1500px) {
    .stats-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 1180px) {
    .stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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


/* Westmark permission system UI */
.westmark-permission-notice {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.permission-muted {
    margin-top: 10px;
    color: rgba(247,239,226,.52);
    font-size: .82rem;
}

button:disabled,
.primary-button:disabled,
.ghost-button:disabled {
    cursor: not-allowed;
    opacity: .45;
    filter: grayscale(.24);
    transform: none !important;
}


/* Sidebar hover bleed fix */
.app-shell {
    overflow-x: hidden;
}

.sidebar {
    overflow-x: clip;
    isolation: isolate;
    z-index: 30;
}

.sidebar nav,
.sidebar .nav-section {
    overflow-x: clip;
}

.nav-item {
    position: relative;
    overflow: hidden;
    max-width: 100%;
    box-sizing: border-box;
    contain: paint;
}

.nav-item:hover {
    transform: translate3d(2px, 0, 0);
}

.nav-item::before,
.nav-item::after {
    pointer-events: none;
}

.main-area {
    position: relative;
    z-index: 1;
    overflow-x: clip;
}

@supports not (overflow: clip) {
    .sidebar,
    .sidebar nav,
    .sidebar .nav-section,
    .main-area,
    .app-shell {
        overflow-x: hidden;
    }
}


/* Collapsible Westmark sidebar */
:root {
    --sidebar-expanded-width: 300px;
    --sidebar-collapsed-width: 92px;
}

.app-shell {
    grid-template-columns: var(--sidebar-expanded-width) minmax(0, 1fr);
    transition: grid-template-columns 260ms cubic-bezier(.22, 1, .36, 1);
}

.sidebar {
    width: var(--sidebar-expanded-width);
    max-width: var(--sidebar-expanded-width);
    transition:
        width 260ms cubic-bezier(.22, 1, .36, 1),
        max-width 260ms cubic-bezier(.22, 1, .36, 1),
        padding 260ms cubic-bezier(.22, 1, .36, 1),
        box-shadow 260ms cubic-bezier(.22, 1, .36, 1);
}

.brand {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 38px;
    gap: 12px;
    align-items: center;
}

.brand-text {
    min-width: 0;
    transition:
        opacity 180ms ease,
        transform 220ms cubic-bezier(.22, 1, .36, 1),
        width 220ms cubic-bezier(.22, 1, .36, 1);
}

.sidebar-toggle-button {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    border: 1px solid rgba(216, 173, 92, .34);
    background:
        linear-gradient(135deg, rgba(216, 173, 92, .16), rgba(255, 255, 255, .05));
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.05),
        0 10px 22px rgba(0,0,0,.20);
    cursor: pointer;
    padding: 0;
}

.sidebar-toggle-button img {
    width: 23px;
    height: 23px;
    display: block;
    transition: transform 260ms cubic-bezier(.22, 1, .36, 1);
}

.sidebar-toggle-button:hover {
    border-color: rgba(216, 173, 92, .58);
    background:
        linear-gradient(135deg, rgba(216, 173, 92, .24), rgba(255, 255, 255, .075));
}

.nav-section-title {
    display: block;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition:
        opacity 180ms ease,
        transform 220ms cubic-bezier(.22, 1, .36, 1),
        height 220ms cubic-bezier(.22, 1, .36, 1),
        margin 220ms cubic-bezier(.22, 1, .36, 1);
}

.nav-label {
    min-width: 0;
    white-space: nowrap;
    transition:
        opacity 180ms ease,
        transform 220ms cubic-bezier(.22, 1, .36, 1),
        width 220ms cubic-bezier(.22, 1, .36, 1);
}

.nav-icon {
    flex: 0 0 22px;
    display: inline-flex;
    justify-content: center;
}

body.sidebar-collapsed .app-shell {
    grid-template-columns: var(--sidebar-collapsed-width) minmax(0, 1fr);
}

body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
    max-width: var(--sidebar-collapsed-width);
    padding: 22px 16px;
}

body.sidebar-collapsed .brand {
    grid-template-columns: 48px;
    justify-items: center;
    gap: 10px;
}

body.sidebar-collapsed .brand-logo,
body.sidebar-collapsed .brand-logo-image {
    margin: 0 auto;
}

body.sidebar-collapsed .brand-text {
    width: 0;
    opacity: 0;
    pointer-events: none;
    transform: translate3d(-8px, 0, 0);
    overflow: hidden;
}

body.sidebar-collapsed .sidebar-toggle-button {
    width: 36px;
    height: 36px;
    grid-column: 1;
}

body.sidebar-collapsed .sidebar-toggle-button img {
    transform: rotate(180deg);
}

body.sidebar-collapsed .nav {
    margin-top: 28px;
}

body.sidebar-collapsed .nav-section {
    margin-top: 20px;
}

body.sidebar-collapsed .nav-section-title {
    height: 12px;
    margin: 4px 0 8px;
    color: transparent;
    font-size: 0;
    letter-spacing: 0;
    opacity: 1;
}

body.sidebar-collapsed .nav-section-title::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 34px;
    height: 1px;
    transform: translate(-50%, -50%);
    background:
        linear-gradient(90deg, transparent, rgba(216, 173, 92, .72), transparent);
    box-shadow: 0 0 14px rgba(216, 173, 92, .22);
}

body.sidebar-collapsed .nav-item {
    justify-content: center;
    width: 48px;
    height: 48px;
    min-height: 48px;
    padding: 0;
    margin-inline: auto;
    gap: 0;
}

body.sidebar-collapsed .nav-item:hover {
    transform: translate3d(0, -1px, 0);
}

body.sidebar-collapsed .nav-label {
    width: 0;
    opacity: 0;
    pointer-events: none;
    transform: translate3d(-6px, 0, 0);
    overflow: hidden;
}

body.sidebar-collapsed .nav-icon {
    flex-basis: auto;
}

body.sidebar-collapsed .nav-icon img {
    width: 22px;
    height: 22px;
}

@media (max-width: 900px) {
    .app-shell,
    body.sidebar-collapsed .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar,
    body.sidebar-collapsed .sidebar {
        width: auto;
        max-width: none;
    }

    body.sidebar-collapsed .brand {
        grid-template-columns: 48px minmax(0, 1fr) 38px;
        justify-items: stretch;
    }

    body.sidebar-collapsed .brand-text,
    body.sidebar-collapsed .nav-label {
        width: auto;
        opacity: 1;
        pointer-events: auto;
        transform: none;
    }

    body.sidebar-collapsed .nav-item {
        justify-content: flex-start;
        width: auto;
        height: auto;
        min-height: 46px;
        padding: 13px 14px;
        margin-inline: 0;
        gap: 12px;
    }

    body.sidebar-collapsed .nav-section-title {
        height: auto;
        color: inherit;
        font-size: inherit;
        letter-spacing: inherit;
        margin: inherit;
    }

    body.sidebar-collapsed .nav-section-title::before {
        display: none;
    }
}


/* Hard fix: stop sidebar menu hover/active bleed completely */
.app-shell {
    overflow-x: hidden !important;
}

.sidebar {
    position: sticky;
    overflow: hidden !important;
    overflow-x: hidden !important;
    clip-path: inset(0 round 0);
    contain: layout paint style;
    isolation: isolate;
}

.sidebar::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 1px;
    background: var(--border);
    pointer-events: none;
    z-index: 5;
}

.sidebar .nav,
.sidebar nav,
.sidebar .nav-section {
    overflow: hidden !important;
    overflow-x: hidden !important;
    contain: paint;
}

.sidebar .nav-item {
    position: relative;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden !important;
    contain: paint;
    transform: none !important;
    will-change: auto !important;
}

.sidebar .nav-item:hover,
.sidebar .nav-item.active,
.sidebar .nav-item:focus,
.sidebar .nav-item:focus-visible,
.sidebar .nav-item:active {
    transform: none !important;
}

.sidebar .nav-item:hover {
    background:
        linear-gradient(135deg, rgba(216, 173, 92, .105), rgba(255, 255, 255, .055));
    border-color: rgba(216, 173, 92, .22);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.04),
        inset 0 0 0 1px rgba(216,173,92,.05) !important;
}

.sidebar .nav-item.active {
    background:
        linear-gradient(135deg, rgba(216, 173, 92, .18), rgba(255,255,255,.055));
    border-color: var(--border-gold);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.06),
        inset 0 0 0 1px rgba(216,173,92,.08) !important;
}

.sidebar .nav-item::before,
.sidebar .nav-item::after {
    inset: 0;
    max-width: 100%;
    overflow: hidden;
    pointer-events: none;
}

.main-area {
    position: relative;
    z-index: 0;
    overflow-x: hidden !important;
    clip-path: inset(0);
}

body.sidebar-collapsed .sidebar .nav-item {
    width: 48px;
    max-width: 48px;
    margin-left: auto;
    margin-right: auto;
}

body.sidebar-collapsed .sidebar .nav-item:hover,
body.sidebar-collapsed .sidebar .nav-item.active,
body.sidebar-collapsed .sidebar .nav-item:active {
    transform: none !important;
}

/* keep press animation away from sidebar, but allow it elsewhere */
.sidebar .nav-item.wm-is-pressed,
.sidebar .nav-item:active {
    transform: none !important;
}


/* Collapsed sidebar alignment fix: keep menu rows at the same vertical height as expanded */
.brand {
    position: relative;
    min-height: 48px;
}

.sidebar-toggle-button {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translate3d(0, -50%, 0);
    z-index: 4;
}

.sidebar-toggle-button:hover {
    transform: translate3d(0, -50%, 0);
}

.sidebar-toggle-button:active,
.sidebar-toggle-button.wm-is-pressed {
    transform: translate3d(0, -50%, 0) scale(.985);
}

body.sidebar-collapsed .sidebar {
    padding-top: 26px;
}

body.sidebar-collapsed .brand {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    height: 48px;
    margin-bottom: 34px;
    gap: 0;
}

body.sidebar-collapsed .brand-logo,
body.sidebar-collapsed .brand-logo-image {
    margin: 0 auto;
    flex: 0 0 48px;
}

body.sidebar-collapsed .sidebar-toggle-button {
    top: 6px;
    right: 0;
    width: 32px;
    height: 32px;
    transform: none;
}

body.sidebar-collapsed .sidebar-toggle-button:hover {
    transform: none;
}

body.sidebar-collapsed .sidebar-toggle-button:active,
body.sidebar-collapsed .sidebar-toggle-button.wm-is-pressed {
    transform: scale(.985);
}

body.sidebar-collapsed .sidebar-toggle-button img {
    width: 21px;
    height: 21px;
    transform: rotate(180deg);
}

body.sidebar-collapsed .nav {
    margin-top: 0;
    gap: 8px;
}

body.sidebar-collapsed .nav-section {
    margin-top: 0;
    gap: 7px;
}

body.sidebar-collapsed .nav-section-title {
    display: block;
    position: relative;
    height: 11px;
    min-height: 11px;
    margin: 0;
    padding: 0 14px;
    color: transparent;
    font-size: 0;
    line-height: 1;
    letter-spacing: 0;
    opacity: 1;
}

body.sidebar-collapsed .nav-section-title::before {
    width: 34px;
    height: 1px;
}

body.sidebar-collapsed .nav-item {
    width: 48px;
    height: 46px;
    min-height: 46px;
    padding: 0;
    margin-inline: auto;
}

/* Mobile keeps the normal full menu layout */
@media (max-width: 900px) {
    .sidebar-toggle-button,
    .sidebar-toggle-button:hover,
    .sidebar-toggle-button:active,
    .sidebar-toggle-button.wm-is-pressed {
        position: static;
        transform: none;
    }

    body.sidebar-collapsed .sidebar-toggle-button,
    body.sidebar-collapsed .sidebar-toggle-button:hover,
    body.sidebar-collapsed .sidebar-toggle-button:active,
    body.sidebar-collapsed .sidebar-toggle-button.wm-is-pressed {
        position: static;
        transform: none;
    }

    body.sidebar-collapsed .brand {
        height: auto;
        min-height: 48px;
        margin-bottom: 34px;
    }
}


/* Sidebar toggle direction/overlap + unified dark background pass */
:root {
    --wm-page-bg-unified: #0f1115;
    --wm-sidebar-bg-unified: #17181a;
    --wm-panel-bg-unified: linear-gradient(145deg, rgba(32, 33, 36, .965), rgba(25, 26, 30, .965));
    --wm-panel-bg-soft-unified: linear-gradient(145deg, rgba(35, 36, 39, .94), rgba(25, 26, 30, .94));
    --wm-field-bg-unified: linear-gradient(145deg, rgba(45, 46, 50, .92), rgba(36, 37, 41, .92));
}

/* Backgrounds should read as one consistent Westmark surface, not different page tints */
body,
.app-shell,
.main-area {
    background: var(--wm-page-bg-unified) !important;
}

.sidebar {
    background:
        linear-gradient(180deg, rgba(23, 24, 26, .985), rgba(19, 21, 24, .985)) !important;
}

.topbar,
.hero-card,
.glass-panel,
.stat-card,
.member-card,
.ticket-card,
.case-card,
.member-admin-box,
.audit-log-row,
.unread-dm-row,
.form-card,
.settings-card,
.voice-card,
.reaction-card,
.rank-card,
.dashboard-card,
.details-card,
.panel-card,
.section-card {
    background: var(--wm-panel-bg-unified) !important;
}

input,
select,
textarea,
.status-row,
.metric-row,
.info-row,
.member-info-row,
.dm-message,
.ticket-message,
.permission-card,
.role-card {
    background: var(--wm-field-bg-unified) !important;
}

/* Correct toggle direction:
   expanded = arrow points left to collapse,
   collapsed = arrow points right to expand */
.sidebar-toggle-button img {
    transform: rotate(180deg) !important;
}

body.sidebar-collapsed .sidebar-toggle-button img {
    transform: rotate(0deg) !important;
}

/* Expanded: button stays beside the Westmark Assistant text without affecting text/logo layout */
.brand {
    grid-template-columns: 48px minmax(0, 1fr) 36px !important;
    column-gap: 12px !important;
}

.sidebar-toggle-button {
    position: static !important;
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    transform: none !important;
    align-self: center !important;
    justify-self: end !important;
}

.sidebar-toggle-button:hover,
.sidebar-toggle-button:active,
.sidebar-toggle-button.wm-is-pressed {
    transform: none !important;
}

/* Collapsed: keep logo and toggle separated instead of overlapping */
body.sidebar-collapsed .brand {
    display: grid !important;
    grid-template-columns: 48px 26px !important;
    grid-template-rows: 48px !important;
    align-items: center !important;
    justify-content: center !important;
    justify-items: center !important;
    column-gap: 2px !important;
    height: 48px !important;
    min-height: 48px !important;
    margin-bottom: 34px !important;
}

body.sidebar-collapsed .brand-logo,
body.sidebar-collapsed .brand-logo-image {
    grid-column: 1 !important;
    width: 48px !important;
    height: 48px !important;
    margin: 0 !important;
}

body.sidebar-collapsed .sidebar-toggle-button {
    position: static !important;
    grid-column: 2 !important;
    width: 26px !important;
    height: 26px !important;
    min-width: 26px !important;
    border-radius: 10px !important;
    padding: 0 !important;
    transform: none !important;
}

body.sidebar-collapsed .sidebar-toggle-button:hover,
body.sidebar-collapsed .sidebar-toggle-button:active,
body.sidebar-collapsed .sidebar-toggle-button.wm-is-pressed {
    transform: none !important;
}

body.sidebar-collapsed .sidebar-toggle-button img {
    width: 18px !important;
    height: 18px !important;
}

/* Preserve menu alignment after compacting the collapsed header */
body.sidebar-collapsed .nav {
    margin-top: 0 !important;
}

body.sidebar-collapsed .nav-section {
    margin-top: 0 !important;
}


/* Card accordion chevron direction fix:
   closed = down, open = up */
.accordion-chevron,
.card-toggle,
.collapse-toggle,
.section-toggle {
    transform: rotate(90deg) !important;
    transition: transform 220ms cubic-bezier(.22, 1, .36, 1), opacity 180ms ease !important;
}

.accordion-chevron img,
.card-toggle img,
.collapse-toggle img,
.section-toggle img {
    transform: none !important;
}

details[open] .accordion-chevron,
details[open] .card-toggle,
details[open] .collapse-toggle,
details[open] .section-toggle,
.accordion-card[open] .accordion-chevron,
.collapsible-card[open] .accordion-chevron,
.is-open .accordion-chevron {
    transform: rotate(-90deg) !important;
}

details[open] .accordion-chevron img,
details[open] .card-toggle img,
details[open] .collapse-toggle img,
details[open] .section-toggle img,
.accordion-card[open] .accordion-chevron img,
.collapsible-card[open] .accordion-chevron img,
.is-open .accordion-chevron img {
    transform: none !important;
}


/* Scroll restore fix:
   allow the document/main content to receive wheel scrolling again */
html,
body {
    min-height: 100%;
    height: auto !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

body {
    overscroll-behavior-y: auto !important;
}

.app-shell {
    min-height: 100vh;
    height: auto !important;
    overflow-x: clip !important;
    overflow-y: visible !important;
}

.main-area {
    min-height: 100vh;
    height: auto !important;
    overflow-x: clip !important;
    overflow-y: visible !important;
    overscroll-behavior: auto !important;
    clip-path: none !important;
}

/* The sidebar may clip horizontally, but must not become the only wheel-scroll target */
.sidebar {
    overflow-x: hidden !important;
    overflow-y: visible !important;
    overscroll-behavior: auto !important;
}

.sidebar .nav,
.sidebar nav,
.sidebar .nav-section {
    overflow-x: hidden !important;
    overflow-y: visible !important;
}

@supports not (overflow: clip) {
    .app-shell,
    .main-area {
        overflow-x: hidden !important;
        overflow-y: visible !important;
    }
}


/* Absolute card chevron fix:
   The SVG asset already points down.
   Closed = down, open = up. Do not rotate the wrapper anymore. */
details summary .accordion-chevron,
details.accordion-card summary .accordion-chevron,
.accordion-card summary .accordion-chevron,
.collapsible-card summary .accordion-chevron,
.accordion-chevron,
.card-toggle,
.collapse-toggle,
.section-toggle {
    transform: none !important;
    rotate: 0deg !important;
    transform-origin: center center !important;
}

details summary .accordion-chevron img,
details.accordion-card summary .accordion-chevron img,
.accordion-card summary .accordion-chevron img,
.collapsible-card summary .accordion-chevron img,
.accordion-chevron img,
.card-toggle img,
.collapse-toggle img,
.section-toggle img {
    transform: rotate(0deg) !important;
    rotate: 0deg !important;
    transform-origin: center center !important;
    transition: transform 220ms cubic-bezier(.22, 1, .36, 1), rotate 220ms cubic-bezier(.22, 1, .36, 1), opacity 180ms ease !important;
}

details[open] summary .accordion-chevron,
details.accordion-card[open] summary .accordion-chevron,
.accordion-card[open] summary .accordion-chevron,
.collapsible-card[open] summary .accordion-chevron,
.is-open .accordion-chevron {
    transform: none !important;
    rotate: 0deg !important;
}

details[open] summary .accordion-chevron img,
details.accordion-card[open] summary .accordion-chevron img,
.accordion-card[open] summary .accordion-chevron img,
.collapsible-card[open] summary .accordion-chevron img,
.is-open .accordion-chevron img {
    transform: rotate(180deg) !important;
    rotate: 0deg !important;
}

/* If a card toggle is a real button with aria-expanded instead of <details>. */
button.accordion-chevron[aria-expanded="false"],
button.card-toggle[aria-expanded="false"],
button.collapse-toggle[aria-expanded="false"],
button.section-toggle[aria-expanded="false"],
[role="button"].accordion-chevron[aria-expanded="false"],
[role="button"].card-toggle[aria-expanded="false"],
[role="button"].collapse-toggle[aria-expanded="false"],
[role="button"].section-toggle[aria-expanded="false"] {
    transform: none !important;
    rotate: 0deg !important;
}

button.accordion-chevron[aria-expanded="false"] img,
button.card-toggle[aria-expanded="false"] img,
button.collapse-toggle[aria-expanded="false"] img,
button.section-toggle[aria-expanded="false"] img,
[role="button"].accordion-chevron[aria-expanded="false"] img,
[role="button"].card-toggle[aria-expanded="false"] img,
[role="button"].collapse-toggle[aria-expanded="false"] img,
[role="button"].section-toggle[aria-expanded="false"] img {
    transform: rotate(0deg) !important;
    rotate: 0deg !important;
}

button.accordion-chevron[aria-expanded="true"],
button.card-toggle[aria-expanded="true"],
button.collapse-toggle[aria-expanded="true"],
button.section-toggle[aria-expanded="true"],
[role="button"].accordion-chevron[aria-expanded="true"],
[role="button"].card-toggle[aria-expanded="true"],
[role="button"].collapse-toggle[aria-expanded="true"],
[role="button"].section-toggle[aria-expanded="true"] {
    transform: none !important;
    rotate: 0deg !important;
}

button.accordion-chevron[aria-expanded="true"] img,
button.card-toggle[aria-expanded="true"] img,
button.collapse-toggle[aria-expanded="true"] img,
button.section-toggle[aria-expanded="true"] img,
[role="button"].accordion-chevron[aria-expanded="true"] img,
[role="button"].card-toggle[aria-expanded="true"] img,
[role="button"].collapse-toggle[aria-expanded="true"] img,
[role="button"].section-toggle[aria-expanded="true"] img {
    transform: rotate(180deg) !important;
    rotate: 0deg !important;
}
