header {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem clamp(1rem, 4vw, 3rem);
    background: rgba(255, 253, 249, 0.88);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(18px);
}

html, body {
    max-width: 100%;
    overflow-x: clip;
}

:root[data-dashboard-theme="dark"] header {
    border-bottom-color: var(--border);
    background: rgba(22, 19, 16, 0.92);
    box-shadow: 0 6px 24px rgba(0, 0, 0, .26);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--text);
    font-family: var(--font-display);
    font-size: 1.38rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-decoration: none;
}

.brand-logo {
    display: block;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    object-fit: contain;
    border-radius: 9px;
    background: #161310;
    box-shadow: 0 4px 12px rgba(22, 19, 16, 0.16);
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    min-width: 0;
}

/* Notifications */
.notification-wrapper {
    position: relative;
}

.notification-button {
    position: relative;
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    border-radius: 50%;
    font-size: 1rem;
}

.notification-button.has-alert {
    color: #dc2626;
    border-color: #ef4444;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 99px;
    background: #dc2626;
    color: #fff;
    font-size: 0.65rem;
    line-height: 18px;
    text-align: center;
}

.notification-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.55rem);
    right: 0;
    z-index: 5;
    width: min(340px, calc(100vw - 2rem));
    max-height: 420px;
    overflow: auto;
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, .98);
    box-shadow: var(--shadow);
}

.notification-menu.is-open {
    display: block;
}

.notification-menu h3 {
    margin: 0 0 0.6rem;
    color: var(--text);
    font-size: 0.9rem;
}

.notification-list {
    display: grid;
    gap: 0.45rem;
}

.notification-item {
    padding: 0.65rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-soft);
}

.notification-item.unread {
    border-color: #ef4444;
    background: #fff5f5;
}

.notification-item strong,
.notification-item small,
.notification-item p {
    display: block;
}

.notification-item strong {
    color: var(--text);
    font-size: 0.75rem;
}

.notification-item small {
    margin-top: 0.2rem;
    color: var(--muted);
    font-size: 0.62rem;
}

.notification-item p {
    margin: 0.35rem 0 0;
    color: var(--text);
    font-size: 0.7rem;
    line-height: 1.45;
    white-space: pre-wrap;
}

.notification-empty {
    color: var(--muted);
    font-size: 0.72rem;
}

:root[data-dashboard-theme="dark"] .notification-menu {
    background: var(--surface);
}

:root[data-dashboard-theme="dark"] .notification-item.unread {
    border-color: #a94a4a;
    background: #382426;
}

/* User Panel & Account Menu */
.user-panel {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.34rem 0.8rem 0.34rem 0.42rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    cursor: pointer;
    transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.user-panel:hover {
    border-color: rgba(59, 130, 246, 0.25);
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.12);
    transform: translateY(-1px);
}

.user-panel.open .account-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.user-avatar {
    display: flex;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    font-size: 0.72rem;
    font-weight: 800;
}

.user-meta {
    display: flex;
    min-width: 0;
    flex-direction: column;
    line-height: 1.2;
}

.user-meta strong {
    overflow: hidden;
    color: var(--text);
    font-size: 0.78rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-meta small {
    display: block;
    max-width: 150px;
    overflow: hidden;
    color: var(--muted);
    font-size: 0.68rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-menu {
    position: absolute;
    top: calc(100% + 0.7rem);
    right: 0;
    z-index: 180;
    width: min(300px, 82vw);
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.15);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px) scale(0.98);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.account-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem 1rem 0.8rem;
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.06), rgba(255, 255, 255, 0));
}

.account-avatar {
    display: flex;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(135deg, #0f172a, #334155);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    font-size: 1rem;
    font-weight: 800;
}

.account-profile-summary {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.account-profile-summary strong {
    overflow: hidden;
    color: #0f172a;
    font-size: 0.96rem;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-profile-summary small {
    overflow: hidden;
    color: #64748b;
    font-size: 0.72rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-menu-list {
    padding: 0.2rem 0.55rem 0.6rem;
}

.account-menu-item {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 0.7rem;
    padding: 0.7rem;
    border: 0;
    border-radius: 12px;
    color: #1e293b;
    background: transparent;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.account-menu-item:hover {
    color: #0f172a;
    background: rgba(15, 23, 42, 0.04);
}

.account-menu-item svg {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    color: #475569;
}

.account-footer {
    padding: 0.6rem 0.55rem 0.7rem;
    border-top: 1px solid rgba(148, 163, 184, 0.25);
}

.account-action {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    padding: 0.75rem 0.8rem;
    border: 0;
    border-radius: 12px;
    color: #ef4444;
    background: transparent;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.account-action:hover {
    color: #dc2626;
    background: rgba(239, 68, 68, 0.05);
}

.account-action svg {
    width: 16px;
    height: 16px;
}

:root[data-dashboard-theme="dark"] .user-panel,
:root[data-dashboard-theme="dark"] .account-menu {
    border-color: var(--border);
    background: var(--surface);
}

:root[data-dashboard-theme="dark"] .account-menu-header {
    border-bottom-color: var(--border);
    background: linear-gradient(135deg, #24272a, #1b1e21);
}

:root[data-dashboard-theme="dark"] .account-profile-summary strong,
:root[data-dashboard-theme="dark"] .account-menu-item {
    color: var(--text);
}

:root[data-dashboard-theme="dark"] .account-profile-summary small {
    color: var(--muted);
}

:root[data-dashboard-theme="dark"] .account-menu-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, .08);
}

:root[data-dashboard-theme="dark"] .account-menu-item svg {
    color: #d0c39e;
}

:root[data-dashboard-theme="dark"] .account-footer {
    border-top-color: var(--border);
}

/* Dashboard Shell & Sidebar */
.dashboard-shell {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    width: 100%;
    min-height: calc(100vh - 72px);
    margin: 0;
}

.dashboard-sidebar {
    position: sticky;
    top: 66px;
    display: flex;
    height: calc(100vh - 66px);
    min-height: 520px;
    flex-direction: column;
    padding: 1.45rem 1rem;
    border-right: 1px solid rgba(185, 165, 138, 0.12);
    background: linear-gradient(180deg, #181411 0%, var(--rail-bg) 100%);
    color: var(--rail-text);
}

.sidebar-caption {
    margin: 0 0 .85rem .75rem;
    color: var(--rail-muted);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.sidebar-nav {
    display: grid;
    gap: .38rem;
}

.sidebar-link {
    display: flex;
    width: 100%;
    min-height: 45px;
    align-items: center;
    gap: .75rem;
    padding: .65rem .85rem;
    border: 1px solid transparent;
    border-radius: 12px;
    color: var(--rail-muted);
    background: transparent;
    font: inherit;
    font-size: .83rem;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: color .18s ease, background .18s ease, border-color .18s ease, transform .18s ease;
}

.sidebar-link:hover {
    color: var(--rail-text);
    border-color: rgba(185, 165, 138, 0.18);
    background: var(--rail-surface);
    transform: translateX(3px);
}

.sidebar-link[aria-current="page"] {
    color: #171717;
    border-color: #B9A58A;
    background: linear-gradient(135deg, #B9A58A 0%, #D4C5AF 100%);
    font-weight: 700;
    box-shadow: 0 10px 24px rgba(185, 165, 138, 0.22);
}

.sidebar-link[aria-current="page"] .sidebar-icon {
    color: #171717;
}

.sidebar-icon {
    flex: 0 0 auto;
    color: var(--rail-muted);
    font-family: "Material Symbols Rounded";
    font-size: 1.25rem;
    font-weight: normal;
    font-style: normal;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "liga";
}

.sidebar-divider {
    height: 1px;
    margin: .95rem .65rem;
    background: rgba(185, 165, 138, 0.16);
}

.sidebar-account {
    display: flex;
    align-items: center;
    gap: .7rem;
    margin-top: auto;
    padding: .8rem;
    border: 1px solid rgba(185, 165, 138, 0.18);
    border-radius: 14px;
    background: rgba(255, 250, 242, 0.04);
}

.sidebar-account-mark {
    display: grid;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    place-items: center;
    border-radius: 10px;
    color: #171717;
    background: linear-gradient(135deg, #B9A58A, #D4C5AF);
    font-family: var(--font-display);
    font-size: .88rem;
    font-weight: 700;
}

.sidebar-account-copy {
    display: grid;
    min-width: 0;
    gap: .15rem;
}

.sidebar-account-copy strong {
    overflow: hidden;
    color: var(--rail-text);
    font-family: var(--font-display);
    font-size: .92rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-account-copy small {
    color: var(--rail-muted);
    font-size: .68rem;
}

:root[data-dashboard-theme="dark"] .dashboard-sidebar {
    background: #0D0B0A;
}

/* Main Content & Summary */
main {
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: clamp(1.25rem, 2vw, 2rem);
}

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 1.4rem;
}

.eyebrow {
    margin: 0 0 0.5rem;
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(2.1rem, 4.5vw, 3.2rem);
    font-weight: 700;
    line-height: 1.06;
    letter-spacing: -0.02em;
}

.page-heading p {
    margin: 0.7rem 0 0;
    color: var(--muted);
    line-height: 1.65;
}

.status {
    min-height: 1.5rem;
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.status.error {
    color: var(--danger);
}

.dashboard-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.summary-card {
    position: relative;
    padding: 1.15rem 1.25rem;
    border: 1px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

:root[data-dashboard-theme="dark"] .summary-card {
    background: var(--surface);
    box-shadow: 0 12px 28px rgba(0, 0, 0, .25);
}

.summary-label {
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.summary-value {
    display: block;
    margin-top: 0.35rem;
    color: var(--text);
    font-family: var(--font-display);
    font-size: 1.85rem;
    font-weight: 700;
}

.dashboard-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.8rem;
}

.dashboard-section-heading h2 {
    margin: 0;
    font-size: 1rem;
}

.dashboard-status {
    text-align: right;
}

.empty {
    padding: 3rem 1rem;
    border: 1px dashed var(--border);
    border-radius: 16px;
    color: var(--muted);
    text-align: center;
    background: rgba(255, 253, 248, 0.55);
}

:root[data-dashboard-theme="dark"] .empty {
    background: rgba(27, 30, 33, .76);
}

.loading {
    color: var(--accent);
    font-weight: 700;
}
