:root {
    --navy-900: #061d2f;
    --navy-800: #0a2d46;
    --navy-700: #123a5d;
    --gold-400: #d9b15d;
    --gold-500: #f0c86a;
    --gold-600: #b88b2d;
    --text-light: #f7f5ef;
    --text-muted: #d4d8da;
    --card-bg: rgba(9, 28, 44, 0.9);
    --panel-bg: rgba(17, 41, 58, 0.95);
    --danger: #f35a5a;
    --success: #55d084;
    --shadow: 0 20px 40px rgba(2, 9, 15, 0.45);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    background: radial-gradient(circle at center, #0b2a42 0%, #061d2f 35%, #041722 100%);
    color: var(--text-light);
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
}

.page-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 48px;
    padding: 40px 24px;
    flex-wrap: wrap;
}

.login-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1 1 420px;
    max-width: 620px;
}

.brand-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 18px;
}

.brand-logo {
    width: min(440px, 80vw);
    filter: drop-shadow(0 14px 30px rgba(0, 0, 0, 0.45));
}

.brand-tag {
    margin-top: 10px;
    font-size: 0.9rem;
    letter-spacing: 0.28rem;
    text-transform: uppercase;
    color: var(--gold-500);
}

.login-card {
    width: min(100%, 430px);
    background: rgba(8, 27, 39, 0.8);
    border: 1px solid rgba(217, 177, 93, 0.4);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 30px 28px;
}

.demo-accounts {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid rgba(217, 177, 93, 0.25);
}

.demo-accounts h2 {
    margin: 0 0 6px;
    color: var(--gold-500);
    font-size: 1.1rem;
}

.demo-account-warning,
.demo-account-hint {
    margin: 6px 0 12px;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.45;
}

.demo-account-warning {
    color: #f9df8d;
}

.demo-account-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
    gap: 8px;
}

.demo-account-button {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    min-width: 0;
    min-height: 72px;
    padding: 10px 12px;
    border: 1px solid rgba(217, 177, 93, 0.35);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-light);
    text-align: left;
    box-shadow: none;
}

.demo-account-button:hover {
    border-color: var(--gold-500);
    background: rgba(217, 177, 93, 0.12);
}

.demo-account-button strong {
    color: var(--gold-500);
}

.demo-account-button span,
.demo-account-button small {
    overflow-wrap: anywhere;
}

.demo-account-button small {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.login-card h1 {
    margin: 0 0 8px;
    font-size: 2rem;
    text-align: center;
    color: var(--gold-500);
}

.subtitle {
    margin: 0 0 22px;
    text-align: center;
    color: var(--text-muted);
    line-height: 1.5;
}

form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

label {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-light);
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(217, 177, 93, 0.45);
    background: rgba(7, 23, 34, 0.92);
    color: var(--text-light);
    outline: none;
    font-size: 1rem;
    color-scheme: dark;
}

input[type="checkbox"],
input[type="radio"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    margin: 0;
    padding: 0;
    accent-color: var(--gold-500);
    cursor: pointer;
}

.table-wrap input[type="checkbox"] {
    display: block;
    margin: 0 auto;
}

select option {
    background: #0c2234;
    color: var(--text-light);
}

input::placeholder,
textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    margin: 0;
    background: linear-gradient(135deg, var(--gold-500), var(--gold-600));
    color: #0c1d2a;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    padding: 10px 18px;
    cursor: pointer;
    transition: filter 0.18s ease, box-shadow 0.18s ease;
    box-shadow: 0 8px 18px rgba(217, 177, 93, 0.25);
}

button:hover:not(:disabled) {
    filter: brightness(1.06);
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
    outline: 3px solid var(--gold-500);
    outline-offset: 3px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}
.password-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.password-wrap input {
    padding-right: 52px;
    -webkit-appearance: none;
    appearance: none;
}
.password-wrap input::-webkit-textfield-decoration-container,
.password-wrap input::-webkit-clear-button,
.password-wrap input::-webkit-inner-spin-button,
.password-wrap input::-webkit-outer-spin-button,
.password-wrap input::-webkit-search-cancel-button,
.password-wrap input::-webkit-search-decoration,
.password-wrap input::-ms-clear,
.password-wrap input::-ms-reveal,
.password-wrap input::-webkit-credentials-auto-fill-button {
    display: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    pointer-events: none;
}
.password-toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    min-height: 44px;
    margin: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.65);
    cursor: pointer;
    z-index: 2;
}
.password-toggle:hover {
    transform: translateY(-50%);
    background: transparent;
    color: var(--text-light);
}
.password-toggle.is-visible {
    color: var(--text-light);
    background: transparent;
}
.login-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 16px;
    text-align: center;
}
.login-links span { color: var(--text-muted); }
.login-links a {
    color: var(--gold-500);
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}
.login-links a:hover { text-decoration: underline; }
.login-hint { color: var(--text-muted); font-size: 0.85rem; text-align: center; line-height: 1.5; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.toolbar .field { min-width: 160px; flex: 1; }
.toolbar .field label { display: block; margin-bottom: 6px; }
.status-form {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    align-items: center;
}
.status-form input {
    width: 120px;
    min-width: 100px;
    padding: 8px 10px;
    font-size: 0.8rem;
}
.status-form button,
.status-form .link-button {
    margin-top: 0;
}
.toolbar button,
.toolbar a.link-button {
    margin-top: 0;
    height: 44px;
    padding: 0 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    font-size: 0.95rem;
    line-height: 1;
    white-space: nowrap;
}
.badge-waitlist { background: rgba(150, 120, 255, 0.18); color: #d6c9ff; }
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.member-card { width: min(560px, 100%); border: 1px solid rgba(217,177,93,0.5); border-radius: 18px; background: linear-gradient(160deg, #0d2337, #08192a); padding: 22px; box-shadow: var(--shadow); }
.member-card h2 { margin: 6px 0 2px; color: var(--gold-500); }
.member-card .code { font-family: monospace; font-size: 1.15rem; letter-spacing: 0.08rem; color: #fff; }
.barcode { height: 48px; margin: 14px 0; background: repeating-linear-gradient(90deg, #fff 0 2px, transparent 2px 5px, #fff 5px 6px, transparent 6px 10px, #fff 10px 13px, transparent 13px 16px); border-radius: 4px; }
.barcode thin { display: none; }
.announcement-item { padding: 14px 0; border-bottom: 1px solid rgba(255,255,255,0.08); }
.announcement-item h3 { margin: 0 0 6px; color: var(--text-light); }
.receipt-box { max-width: 720px; margin: 0 auto; }
.receipt-box h2 { color: #111; }
.pill { display: inline-block; padding: 4px 10px; border-radius: 999px; background: rgba(217,177,93,0.15); color: var(--gold-500); font-size: 0.8rem; font-weight: 700; }
.help-doc {
    display: grid;
    gap: 22px;
}

.help-summary {
    padding: 26px 28px;
}

.help-summary h2 {
    margin: 8px 0 6px;
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    color: var(--gold-500);
}

.help-section {
    padding: 24px 28px;
}

.help-section h3 {
    margin-top: 0;
    color: var(--gold-500);
    font-size: 1.3rem;
}

.help-section h4 {
    margin-bottom: 10px;
    color: var(--text-light);
}

.help-section p,
.help-section li {
    color: var(--text-muted);
    line-height: 1.7;
}

.help-section ul,
.help-section ol {
    margin: 0 0 18px 20px;
    padding-left: 8px;
}

.help-section ul:last-child,
.help-section ol:last-child {
    margin-bottom: 0;
}

.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-top: 14px;
}

.feature-panel {
    flex: 1 1 360px;
    max-width: 540px;
    display: grid;
    gap: 20px;
}

.feature-card {
    background: rgba(10, 33, 47, 0.9);
    border: 1px solid rgba(217, 177, 93, 0.25);
    border-radius: 16px;
    padding: 22px 20px;
    box-shadow: var(--shadow);
}

.feature-card h2 {
    margin: 0 0 10px;
    color: var(--gold-500);
    font-size: 1.3rem;
}

.feature-card p {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.6;
}

.dashboard-body {
    background: #071b2a;
}

.dashboard-shell {
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    overflow: hidden;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 10;
    width: 260px;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    background: #0d2337;
    border-right: 1px solid rgba(217, 177, 93, 0.35);
    padding: 26px 18px;
}

.sidebar-brand {
    display: flex;
    justify-content: center;
    margin-bottom: 26px;
}

.sidebar-logo {
    width: 170px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-nav a {
    color: var(--text-light);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.03);
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid transparent;
}

.sidebar-nav a.active,
.sidebar-nav a:hover {
    border-color: rgba(217, 177, 93, 0.4);
    color: var(--gold-500);
}

.sidebar-toggle,
.sidebar-backdrop {
    display: none;
}

.dashboard-main {
    flex: 1;
    min-width: 0;
    height: 100vh;
    height: 100dvh;
    margin-left: 260px;
    overflow-y: auto;
    padding: 36px;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 30px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--gold-500);
    text-transform: uppercase;
    letter-spacing: 0.12rem;
    font-size: 0.8rem;
}

.dashboard-header h1 {
    margin: 0;
    font-size: clamp(2rem, 3vw, 2.5rem);
}

.header-help-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(217, 177, 93, 0.12);
    border: 1px solid rgba(217, 177, 93, 0.45);
    color: var(--gold-500);
    text-decoration: none;
    font-weight: 700;
}

.user-meta {
    color: var(--text-muted);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 16px;
}

.notification-menu {
    position: relative;
}

.notification-menu summary {
    cursor: pointer;
    list-style: none;
    color: var(--text-light);
}

.notification-menu summary::-webkit-details-marker {
    display: none;
}

.notification-count {
    display: inline-block;
    min-width: 20px;
    padding: 2px 6px;
    border-radius: 999px;
    background: #d84c4c;
    color: #fff;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.notification-panel {
    position: absolute;
    z-index: 5;
    top: calc(100% + 10px);
    right: 0;
    width: min(360px, 85vw);
    max-height: 65vh;
    overflow-y: auto;
    padding: 14px;
    border: 1px solid rgba(217, 177, 93, 0.4);
    border-radius: 12px;
    background: #0d2337;
    color: var(--text-light);
    box-shadow: var(--shadow);
}

.notification-item {
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.notification-item.unread {
    border-left: 3px solid var(--gold-500);
    padding-left: 10px;
}

.notification-item p {
    margin: 6px 0;
}

.notification-item small {
    color: var(--text-muted);
}

.notification-item form {
    margin-top: 6px;
}

.member-notification-toast {
    position: fixed;
    z-index: 1100;
    top: 18px;
    left: 18px;
    width: min(390px, calc(100vw - 36px));
    margin: 0;
    opacity: 1;
    transform: translateX(0);
    transition: opacity 240ms ease, transform 240ms ease;
}

.member-notification-toast.is-hidden {
    display: none;
}

.member-notification-toast.is-leaving {
    opacity: 0;
    transform: translateX(calc(100vw + 420px));
}

.member-notification-toast-button {
    display: flex;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
    padding: 16px 18px;
    border: 1px solid rgba(217, 177, 93, 0.75);
    border-radius: 12px;
    background: #0d2337;
    color: var(--text-light);
    text-align: left;
    box-shadow: var(--shadow);
    cursor: pointer;
}

.member-notification-toast-button:hover,
.member-notification-toast-button:focus-visible {
    background: #14324b;
}

.member-notification-toast-label {
    color: var(--gold-500);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.member-notification-toast-title {
    font-size: 1rem;
}

.member-notification-toast-message {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.45;
}

.flash {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 18px;
    font-weight: 600;
}

.flash-success {
    background: rgba(85, 208, 132, 0.16);
    border: 1px solid rgba(85, 208, 132, 0.5);
    color: #aef0c0;
}

.flash-error {
    background: rgba(243, 90, 90, 0.14);
    border: 1px solid rgba(243, 90, 90, 0.55);
    color: #ffb6b6;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 18px;
}

.stat-box {
    background: rgba(10, 33, 47, 0.9);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid rgba(217, 177, 93, 0.25);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stat-box span {
    color: var(--text-muted);
}

.stat-box strong {
    font-size: 2rem;
    color: var(--gold-500);
}

.content-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 24px;
    margin-top: 26px;
}

.card {
    background: rgba(10, 33, 47, 0.9);
    border: 1px solid rgba(217, 177, 93, 0.25);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.card h2,
.card h3 {
    margin-top: 0;
    color: var(--gold-500);
}

.section-heading,
.record-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.section-heading h2 {
    margin-bottom: 0;
}

.record-actions {
    justify-content: flex-end;
    margin-bottom: 18px;
}

.record-fields {
    margin: 0;
}

.record-fields > div {
    display: grid;
    grid-template-columns: minmax(140px, 220px) 1fr;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.record-fields dt {
    color: var(--text-muted);
    font-weight: 700;
}

.record-fields dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.form-grid > div {
    display: grid;
    grid-template-rows: minmax(2.5em, auto) auto;
    align-content: start;
    min-width: 0;
}

.form-grid > div > label {
    align-self: end;
    margin-bottom: 6px;
    line-height: 1.25;
}

.form-grid > div > input,
.form-grid > div > select,
.form-grid > div > textarea {
    grid-row: 2;
}

.form-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.inline-form {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.status-form,
.delete-form {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap;
    margin: 0;
}

.status-form > input:not([type="hidden"]),
.status-form > select {
    flex: 1 1 10rem;
    width: auto;
    min-width: 120px;
}

.status-form > button,
.status-form > .link-button,
.delete-form > button {
    flex: 0 0 auto;
}

.table-status-select {
    min-width: 120px;
    width: auto;
    background: rgba(7, 23, 34, 0.92);
    color: var(--text-light);
    border: 1px solid rgba(217, 177, 93, 0.45);
    border-radius: 8px;
    padding: 8px 10px;
}

.table-wrap {
    overflow-x: auto;
    margin-top: 18px;
    border-radius: 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--gold-600) rgba(255, 255, 255, 0.06);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.table-wrap table {
    margin: 0;
}

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-align: left;
}

th {
    color: var(--gold-500);
    font-size: 0.8rem;
    letter-spacing: 0.08rem;
    text-transform: uppercase;
}

.badge {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}

.badge-active {
    background: rgba(85, 208, 132, 0.12);
    color: #b9f5d2;
}

.badge-pending {
    background: rgba(240, 200, 106, 0.12);
    color: #f9df8d;
}

.badge-inactive {
    background: rgba(243, 90, 90, 0.12);
    color: #ffb6b6;
}

.badge-expired {
    background: rgba(243, 90, 90, 0.2);
    color: #ffc1a8;
}

.muted {
    color: var(--text-muted);
}

.action-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    min-width: max-content;
}

.action-row form {
    flex: 0 0 auto;
    margin: 0;
}

.link-button,
.delete-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    text-decoration: none;
    border: none;
    border-radius: 10px;
    padding: 8px 12px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: filter 0.18s ease, background-color 0.18s ease;
}

.link-button:hover,
.delete-button:hover {
    filter: brightness(1.15);
}

.link-button {
    background: rgba(240, 200, 106, 0.18);
    color: var(--gold-500);
}

.delete-button {
    background: rgba(243, 90, 90, 0.16);
    color: #ffb6b6;
    border: 1px solid rgba(243, 90, 90, 0.4);
    min-width: 80px;
}

.footer-note {
    margin-top: 18px;
    color: var(--text-muted);
}

/* --- Admin dashboard visualizations (charts) --- */
.charts-section {
    margin-top: 28px;
}
.charts-heading {
    align-items: flex-end;
}
.charts-heading h2,
.charts-subtitle {
    margin: 0;
}
.charts-subtitle {
    margin-top: 6px;
    max-width: 640px;
}
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 18px;
}
.chart-card--wide {
    grid-column: span 2;
}
.chart-card h3 {
    margin: 0 0 14px;
    font-size: 1.1rem;
}
.chart-wrap {
    display: flex;
    gap: 20px;
    align-items: center;
    min-height: 180px;
}
.chart-svg {
    width: min(220px, 100%);
    height: auto;
    flex: 0 0 auto;
}
.chart-bars-svg {
    width: 100%;
    max-width: 720px;
}
.chart-center-value {
    fill: var(--gold-500);
    font-size: 30px;
    font-weight: 700;
    font-family: Arial, Helvetica, sans-serif;
}
.chart-center-label {
    fill: var(--text-muted);
    font-size: 12px;
    letter-spacing: 0.08rem;
    text-transform: uppercase;
    font-family: Arial, Helvetica, sans-serif;
}
.chart-axis {
    fill: var(--text-muted);
    font-size: 11px;
    font-family: Arial, Helvetica, sans-serif;
}
.chart-bar-label {
    fill: var(--text-light);
    font-size: 10px;
    font-weight: 700;
    font-family: Arial, Helvetica, sans-serif;
}
.chart-gridline {
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 1;
}
.chart-baseline {
    stroke: rgba(217, 177, 93, 0.45);
    stroke-width: 1.5;
}
.chart-bar--paid {
    fill: #55d084;
}
.chart-bar--outstanding {
    fill: #f0c86a;
}
.chart-bar,
.chart-segment {
    transition: opacity 0.2s ease, stroke-width 0.2s ease;
}
.chart-donut:hover .chart-segment,
.chart-bars-svg:hover .chart-bar {
    opacity: 0.35;
}
.chart-donut:hover .chart-segment:hover,
.chart-bars-svg:hover .chart-bar:hover {
    opacity: 1;
}
.chart-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
    flex: 1;
}
.chart-legend--inline {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-top: 10px;
}
.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}
.chart-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex: 0 0 auto;
}
.chart-legend-label {
    color: var(--text-light);
}
.chart-legend-value {
    margin-left: auto;
    color: var(--gold-500);
    font-weight: 700;
}
.chart-empty {
    color: var(--text-muted);
    margin: 12px 0;
}
.hbars {
    display: grid;
    gap: 12px;
}
.hbar-row {
    display: grid;
    grid-template-columns: minmax(110px, 180px) 1fr 90px;
    align-items: center;
    gap: 12px;
}
.hbar-label {
    color: var(--text-light);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hbar-track {
    display: block;
    height: 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}
.hbar-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    animation: chart-grow 0.7s ease both;
    transition: opacity 0.2s ease;
}
.hbar-row:hover .hbar-fill {
    opacity: 0.85;
}
.hbar-value {
    color: var(--gold-500);
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
}
@keyframes chart-grow {
    from { width: 0; }
}
.chart-details {
    margin-top: 14px;
}
.chart-details summary {
    cursor: pointer;
    color: var(--gold-500);
    font-weight: 700;
    font-size: 0.9rem;
}
.chart-table-wrap {
    margin-top: 10px;
}
.chart-table {
    min-width: 0;
}
.chart-table td:last-child,
.chart-table th:last-child {
    text-align: right;
}

@media (max-width: 768px) {
    .page-shell {
        padding-top: 24px;
        padding-bottom: 24px;
    }

    .dashboard-shell {
        height: auto;
        min-height: 100vh;
        min-height: 100dvh;
        flex-direction: column;
        overflow: visible;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 31;
        width: min(300px, 85vw);
        height: 100vh;
        height: 100dvh;
        overflow-x: hidden;
        overflow-y: auto;
        transform: translateX(-105%);
        transition: transform 0.22s ease;
        box-shadow: var(--shadow);
    }

    .sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-toggle {
        position: fixed;
        top: 12px;
        left: 12px;
        z-index: 30;
        display: inline-flex;
        width: 48px;
        height: 48px;
        min-height: 48px;
        padding: 0;
        border: 1px solid rgba(217, 177, 93, 0.5);
        border-radius: 12px;
        background: #0d2337;
        color: var(--gold-500);
        box-shadow: var(--shadow);
    }

    .sidebar-open .sidebar-toggle {
        z-index: 32;
    }

    .sidebar-toggle:hover {
        background: #123a5d;
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 29;
        display: block;
        width: 100%;
        height: 100%;
        min-height: 100%;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: rgba(0, 0, 0, 0.58);
        box-shadow: none;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.22s ease;
    }

    .sidebar-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .dashboard-main {
        height: auto;
        margin-left: 0;
        overflow: visible;
        padding: 76px 16px 28px;
    }

    .content-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .chart-card--wide {
        grid-column: span 1;
    }

    .chart-wrap {
        flex-direction: column;
        align-items: flex-start;
    }

    .hbar-row {
        grid-template-columns: minmax(90px, 130px) 1fr 76px;
        gap: 8px;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .user-meta {
        width: 100%;
        flex-wrap: wrap;
        gap: 10px 14px;
    }

    .notification-panel {
        width: min(320px, calc(100vw - 32px));
    }

    .card,
    .content-grid > *,
    .stats-grid > * {
        min-width: 0;
    }

    .form-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .form-grid > div {
        grid-template-rows: auto auto;
    }

    .form-grid > div > label {
        min-height: 0;
        align-self: start;
    }

    .status-form,
    .delete-form {
        flex-wrap: wrap;
        max-width: 100%;
    }

    .status-form > input:not([type="hidden"]),
    .status-form > select {
        flex: 1 1 100%;
        min-width: 0;
    }

    .status-form > *,
    .delete-form > * {
        min-width: 0;
    }

    .action-row {
        flex-wrap: wrap;
        min-width: 0;
    }

    .record-fields > div {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .notification-panel {
        right: auto;
        left: 0;
    }

    .section-heading,
    .record-actions {
        flex-wrap: wrap;
    }
}

@media (min-width: 769px) and (max-width: 1100px) {
    .sidebar {
        width: 220px;
        padding: 22px 14px;
    }

    .dashboard-main {
        margin-left: 220px;
        padding: 28px 22px;
    }

    .content-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
    }
}

@media (max-width: 480px) {
    .dashboard-main {
        padding: 72px 12px 22px;
    }

    .card {
        padding: 16px;
        border-radius: 12px;
    }

    .dashboard-header h1 {
        font-size: clamp(1.6rem, 8vw, 2rem);
        overflow-wrap: anywhere;
    }

    .stat-box {
        padding: 16px;
    }

    .stat-box strong {
        font-size: 1.6rem;
        overflow-wrap: anywhere;
    }

    .section-heading,
    .record-actions,
    .form-actions {
        align-items: stretch;
    }

    .section-heading > *,
    .record-actions > *,
    .form-actions > * {
        max-width: 100%;
    }

    .hbar-row {
        grid-template-columns: minmax(0, 1fr) 64px;
    }

    .hbar-track {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .hbar-value {
        grid-column: 2;
        grid-row: 1;
    }
}

@media print {
    :root {
        color-scheme: light;
    }

    body,
    .dashboard-body {
        background: #fff !important;
        color: #111 !important;
    }

    .sidebar,
    .sidebar-toggle,
    .sidebar-backdrop,
    .member-notification-toast,
    .user-meta,
    .no-print,
    .print-exclude,
    .footer-note {
        display: none !important;
    }

    .dashboard-shell,
    .dashboard-main {
        display: block;
        width: 100%;
        height: auto;
        min-height: 0;
        margin: 0;
        overflow: visible;
        padding: 0;
    }

    .dashboard-header {
        margin: 0 0 18px;
        color: #111;
    }

    .dashboard-header h1,
    .card h2,
    .card h3,
    .record-fields dt {
        color: #111 !important;
    }

    .chart-axis {
        fill: #555 !important;
    }

    .chart-bar-label,
    .chart-center-value,
    .hbar-label,
    .chart-legend-label {
        fill: #111 !important;
        color: #111 !important;
    }

    .chart-center-label,
    .hbar-value,
    .chart-legend-value,
    .chart-details summary {
        fill: #555 !important;
        color: #555 !important;
    }

    .chart-gridline {
        stroke: #ddd !important;
    }

    .hbar-track {
        background: #eee !important;
    }

    .card {
        border: 0;
        border-radius: 0;
        padding: 0;
        box-shadow: none;
        background: #fff !important;
        color: #111 !important;
    }

    .table-wrap {
        overflow: visible;
    }

    table {
        min-width: 0;
    }

    th,
    td,
    .record-fields > div {
        border-color: #bbb;
        color: #111 !important;
    }

    a {
        color: #111 !important;
        text-decoration: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .member-notification-toast {
        transition-duration: 1ms;
    }
}
