/**
 * App dashboard — ALROYA theme
 */

/* Layout tokens live in glass-theme.css (:root) */

/* App shell */
body.app-dashboard {
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
}

body.app-dashboard > .app-layout {
    flex: 1;
    min-height: 0;
    display: flex;
    width: 100%;
}

body.app-dashboard::before {
    opacity: 0.05;
}

.app-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    width: 100%;
    position: relative;
}

/* Overlay (mobile) */
.nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 180;
    opacity: 0;
    transition: opacity var(--transition);
    pointer-events: none;
}

.nav-overlay.is-open {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    height: 100dvh;
    background: linear-gradient(180deg, var(--sidebar-grad-start, #2d3a66) 0%, var(--sidebar-grad-mid, var(--brand)) 48%, var(--sidebar-grad-end, #1a2340) 100%);
    color: #f8fafc;
    z-index: 200;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 32px rgba(26, 35, 64, 0.18);
    transform: translateX(0);
    transition: transform var(--transition), box-shadow var(--transition);
}

body.sidebar--collapsed .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
}

body.sidebar--collapsed .app-main {
    margin-left: 0 !important;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar__brand > div:last-child {
    min-width: 0;
    flex: 1;
}

.sidebar__logo-btn {
    flex-shrink: 0;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 50%;
    transition: var(--transition);
    line-height: 0;
}

.sidebar__logo-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.25);
}

.sidebar__logo-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.sidebar__logo {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.92);
    border: 2px solid rgba(255, 255, 255, 0.35);
    display: block;
}

.sidebar__title {
    font-family: 'Poppins', 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.04em;
    line-height: 1.2;
    color: #fff;
    text-transform: uppercase;
}

.sidebar__subtitle {
    font-size: 0.68rem;
    font-weight: 500;
    opacity: 0.78;
    margin-top: 6px;
    letter-spacing: 0.02em;
    line-height: 1.4;
    text-transform: none;
    overflow-wrap: anywhere;
}

.sidebar__nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 10px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    scrollbar-gutter: stable;
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
    border-left: 4px solid transparent;
    margin-left: 0;
}

/* منع اللون البنفسجي للروابط المُزارَة (يظهر غالباً على Out) */
.sidebar__link:visited,
.sidebar__link:visited:hover,
.sidebar__link:visited.is-active {
    color: rgba(255, 255, 255, 0.92);
}

.sidebar__link i {
    width: 1.25rem;
    text-align: center;
    opacity: 0.9;
    flex-shrink: 0;
}

.sidebar__link > span {
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.25;
    min-width: 0;
}

.sidebar__link-ar {
    font-family: 'Tajawal', 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.78) !important;
    opacity: 1;
}

.sidebar__link:hover .sidebar__link-ar,
.sidebar__link.is-active .sidebar__link-ar,
.sidebar__link:visited .sidebar__link-ar {
    color: rgba(255, 255, 255, 0.9) !important;
}

.sidebar__link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.sidebar__link.is-active {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    border-left-color: var(--brand-light, #8b9dd9);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

/* اسم الموقع يُعرض في الهيدر — إخفاء من الشريط */
.sidebar__site {
    display: none !important;
}

.sidebar__footer {
    padding: 12px 16px 16px;
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    flex-direction: column;
    gap: 0;
}

.sidebar__logout {
    width: 100%;
    padding: 14px 14px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
}

.sidebar__logout:hover {
    background: rgba(255, 255, 255, 0.28);
}

/* Main column */
.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--workspace-bg);
    transition: margin-left var(--transition);
}

/* Header */
.header-bar {
    position: relative;
    flex-shrink: 0;
    min-height: var(--header-h);
    display: flex;
    align-items: center;
    gap: var(--space-2, 16px);
    padding: 12px var(--space-3, 24px);
    background: var(--surface, #fff);
    border-bottom: 1px solid var(--border-default, #dbe3f0);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 4px 20px rgba(61, 79, 143, 0.06);
    z-index: 50;
    color: var(--text-heading, #0f172a);
}

.header-bar__leading {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.header-bar__fab-logo {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 50%;
    transition: var(--transition);
    line-height: 0;
}

.header-bar__fab-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(61, 79, 143, 0.32);
    box-shadow: 0 2px 8px rgba(61, 79, 143, 0.16);
}

.header-bar__fab-logo:hover .header-bar__fab-img {
    border-color: rgba(61, 79, 143, 0.48);
    transform: scale(1.04);
}

body.sidebar--collapsed .header-bar__fab-logo {
    display: inline-flex;
}

.header-bar__toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--border-default, #dbe3f0);
    border-radius: 10px;
    background: var(--light, #f8fafc);
    color: var(--brand, #3d4f8f);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.header-bar__toggle:hover {
    background: #eef2f9;
    border-color: var(--brand-light, #8b9dd9);
}

.header-bar__toggle i {
    font-size: 1.25rem;
}

.header-bar__title {
    display: none;
    align-items: center;
    gap: 10px;
    font-family: 'Poppins', 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.15rem;
    color: #0f172a;
    min-width: 0;
}

.header-bar__title span {
    min-width: 0;
    overflow-wrap: anywhere;
    line-height: 1.25;
}

.header-bar__logo-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.35);
}

.header-bar__spacer {
    flex: 1;
}

/* هيدر غني: اسم موقع بالوسط + بحث يمين */
.header-bar--rich {
    flex-wrap: wrap;
    min-height: 72px;
    align-items: center;
}

.header-bar__center {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 0;
    order: 2;
}

.header-bar--rich .header-bar__leading {
    order: 1;
}

.header-bar--rich .header-bar__title {
    order: 3;
}

.header-bar__search-slot {
    flex-shrink: 0;
    order: 4;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.header-bar__search-slot .search-container {
    margin-left: 0;
}

.header-bar__search-slot--empty {
    display: none !important;
}

.site-name-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 10px 28px;
    max-width: min(100%, 520px);
    background: #ffffff;
    border: 1px solid #94a3b8;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.site-name-badge .nav-site-label {
    font-family: 'Poppins', 'Inter', sans-serif;
    font-size: 1.35rem;
    font-weight: 800;
    color: #000000;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 56vw;
}

.site-name-badge .nav-site-switcher,
.nav-site-switcher {
    font-family: 'Poppins', 'Inter', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: #000000;
    min-width: min(100%, 280px);
    max-width: min(100%, 420px);
    padding: 8px 12px;
    border: 1px solid #64748b;
    border-radius: 10px;
    background: #ffffff;
    cursor: pointer;
}

.header-bar__trailing {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    min-width: 0;
    margin-inline-start: auto;
}

/* Profile + dark mode + logout — single row, no overlap */
.header-bar__end {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    min-width: 0;
    margin-inline-start: auto;
}

.header-bar--rich .header-bar__end {
    grid-column: -1;
    grid-row: 1;
    justify-self: end;
}

.header-bar--rich.header-bar--no-search-slot .header-bar__end {
    grid-column: 2;
}

.header-bar__user-chip {
    order: 4;
    display: inline-flex;
    align-items: flex-start;
    gap: 10px;
    flex-shrink: 0;
    max-width: min(42vw, 240px);
    padding: 5px 14px 5px 5px;
    margin-inline-end: 0;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.55);
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.header-bar__user-chip--compact {
    padding: 4px 12px 4px 4px;
    max-width: min(44vw, 220px);
}

.header-bar__user-chip--compact .header-bar__user-name {
    font-size: 0.88rem;
    max-width: 130px;
}

.header-bar__user-chip--compact .header-bar__user-role {
    font-size: 0.68rem;
    max-width: 130px;
}

.header-bar__user-avatar-wrap {
    position: relative;
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    align-self: center;
}

.header-bar__user-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.15);
}

.header-bar__user-initials {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.header-bar__user-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    min-width: 0;
    line-height: 1.2;
    padding-top: 2px;
    padding-bottom: 2px;
}

.header-bar__user-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.header-bar__user-role {
    font-size: 0.7rem;
    font-weight: 700;
    color: #475569;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
    margin-top: 1px;
}

.header-bar__logout {
    order: 5;
    padding: 10px 16px;
    border-radius: 10px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #0f172a;
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
}

.header-bar__logout:hover {
    background: rgba(255, 255, 255, 0.28);
    transform: translateY(-1px);
}

/* Floating action buttons — shared stack (AI + theme on login/mobile only) */
:root {
    --alroya-fab-size: 52px;
    --alroya-fab-gap: 12px;
    --alroya-fab-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
    --alroya-fab-right: calc(22px + env(safe-area-inset-right, 0px));
}

body.app-dashboard #alroyaThemeFab {
    display: none !important;
}

body.alroya-fab-stack--dual #alroyaThemeFab {
    bottom: calc(var(--alroya-fab-bottom) + var(--alroya-fab-size) + var(--alroya-fab-gap));
}

/* Dark / light mode — header + floating quick access */
.theme-toggle-btn--header {
    width: auto !important;
    margin: 0 !important;
    padding: 8px 14px !important;
    min-height: 40px;
    flex-shrink: 0;
    border-radius: 10px;
    border: 1px solid var(--border-default, #cbd5e1);
    background: var(--glass-bg-muted, rgba(241, 245, 249, 0.9));
    color: var(--text-heading, #0f172a);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    transition: var(--transition);
}

.theme-toggle-btn--header:hover {
    background: var(--glass-bg, #e2e8f0);
    transform: translateY(-1px);
}

.theme-toggle-btn--header .theme-toggle-btn__lbl {
    white-space: nowrap;
}

.theme-toggle-btn--fab {
    position: fixed;
    bottom: var(--alroya-fab-bottom);
    right: var(--alroya-fab-right);
    z-index: 3500;
    width: 52px !important;
    height: 52px !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    border: 2px solid rgba(255, 255, 255, 0.35);
    background: linear-gradient(145deg, #2d3a66 0%, #1a2340 100%);
    color: #fff;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.28);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.theme-toggle-btn--fab:hover {
    transform: scale(1.06);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.35);
}

body.m-app .theme-toggle-btn--fab {
    bottom: calc(var(--m-nav-h, 64px) + 18px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 768px) {
    .theme-toggle-btn--header .theme-toggle-btn__lbl {
        display: none;
    }
    .theme-toggle-btn--header {
        min-width: 40px;
        padding: 8px 10px !important;
    }
}

.main-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2, 16px);
    padding: var(--space-3, 24px);
    padding-bottom: var(--space-4, 32px);
    overflow: auto;
}

.main-content--dense {
    padding: 12px 16px 24px;
    gap: 10px;
}

.dashboard-card {
    background: #fff;
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    transition: var(--transition);
}

/* Desktop */
@media (min-width: 769px) {
    .header-bar__toggle {
        display: none !important;
    }

    .header-bar--rich .header-bar__title {
        display: none !important;
    }

    .header-bar:not(.header-bar--rich) .header-bar__title {
        display: none !important;
    }

    .sidebar__footer .sidebar__logout {
        display: block;
    }

    .header-bar__logout {
        display: none;
    }

    .header-bar__user-chip {
        order: unset;
        grid-column: 4;
        grid-row: 1;
        justify-self: end;
        max-width: min(44vw, 210px);
    }

    .header-bar__trailing .header-bar__user-chip {
        grid-column: auto;
        justify-self: auto;
    }

    .header-bar__user-name {
        max-width: 120px;
    }

    .header-bar__user-role {
        max-width: 120px;
    }

    .header-bar--rich {
        display: grid;
        grid-template-columns: auto 1fr minmax(180px, 1fr) auto;
        grid-template-rows: auto;
        align-items: center;
        gap: 12px 16px;
    }

    .header-bar--rich .header-bar__trailing {
        grid-column: 3 / -1;
        grid-row: 1;
        justify-self: end;
        margin-inline-start: 0;
    }

    .header-bar--rich .header-bar__leading {
        grid-column: 1;
        grid-row: 1;
    }

    .header-bar--rich .header-bar__center {
        grid-column: 2;
        grid-row: 1;
        justify-self: center;
    }

    .header-bar--rich .header-bar__search-slot:not(.header-bar__search-slot--empty) {
        grid-column: 3;
        grid-row: 1;
    }

    .header-bar--rich .header-bar__search-slot--empty {
        display: none !important;
    }

    .header-bar--rich.header-bar--no-search-slot {
        grid-template-columns: auto 1fr;
    }

    /* TimeSheet: Days in Period يسار اسم الموقع، التصدير يمينه */
    .header-bar--rich.header-bar--timesheet {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .header-bar--timesheet .header-bar__leading {
        grid-column: 1;
        grid-row: 1;
    }

    .header-bar--timesheet .header-bar__timesheet-main {
        grid-column: 2;
        grid-row: 1;
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: flex-end;
        gap: 12px 20px;
        min-width: 0;
    }

    .header-bar--timesheet .header-bar__ts-left {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-end;
        gap: 10px 14px;
        justify-content: flex-start;
        min-width: 0;
    }

    .header-bar--timesheet .header-bar__ts-center {
        display: flex;
        justify-content: center;
        align-items: center;
        min-width: 0;
    }

    .header-bar--timesheet .header-bar__ts-center .site-name-badge {
        max-width: min(100%, 480px);
    }

    .header-bar--timesheet .header-bar__ts-right {
        display: flex;
        align-items: flex-end;
        justify-content: flex-end;
        flex-shrink: 0;
        gap: 8px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    body.app-dashboard .app-layout {
        position: relative;
        min-height: 100dvh;
    }

    body.sidebar--collapsed .sidebar {
        transform: translateX(-100%);
    }

    .nav-overlay {
        position: absolute;
    }

    .sidebar {
        position: absolute;
        transform: translateX(-100%);
        box-shadow: none;
    }

    .sidebar.is-open {
        transform: translateX(0);
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.35);
    }

    .app-main {
        margin-left: 0 !important;
    }

    .header-bar__toggle {
        display: inline-flex;
    }

    .header-bar__title {
        display: flex;
    }

    .sidebar__footer {
        display: none;
    }

    .header-bar__logout {
        display: inline-block;
    }

    .header-bar--rich {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        min-height: auto;
        padding-bottom: 14px;
    }

    .header-bar--rich .header-bar__leading {
        width: 100%;
        justify-content: space-between;
    }

    .header-bar--rich .header-bar__center {
        order: 0;
        width: 100%;
    }

    .header-bar--rich .site-name-badge {
        width: 100%;
        max-width: none;
    }

    .site-name-badge .nav-site-label {
        font-size: 1.05rem;
        max-width: 85vw;
    }

    .header-bar--rich .header-bar__trailing {
        order: 4;
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 8px;
    }

    .header-bar__end {
        flex-wrap: wrap;
        justify-content: flex-end;
        max-width: 100%;
    }

    .header-bar--rich .header-bar__end {
        width: 100%;
        justify-content: flex-end;
    }

    .header-bar--rich .header-bar__search-slot:not(.header-bar__search-slot--empty) {
        width: 100%;
        order: 6;
    }

    .header-bar__user-chip {
        max-width: min(70vw, 220px);
    }

    .header-bar__user-avatar-wrap,
    .header-bar__user-avatar {
        width: 48px;
        height: 48px;
    }

    .header-bar--rich .header-bar__search-slot .search-container {
        width: 100%;
        margin-left: 0;
    }

    .header-bar--rich .header-bar__search-slot .search-container input {
        flex: 1;
        width: auto !important;
        min-width: 0;
    }

    .main-content {
        padding: 12px;
    }

    .main-content--dense {
        padding: 8px 10px 16px;
    }

    .dash-hero {
        --dash-hero-avatar: 120px;
        height: var(--dash-hero-avatar);
        min-height: var(--dash-hero-avatar);
        padding: 0 12px 0 0;
        gap: 10px;
    }

    .dash-hero__welcome {
        gap: 10px;
        min-width: 0;
    }

    .dash-hero__avatar-initials {
        font-size: 2rem;
    }

    .dash-hero__greeting {
        font-size: 11px;
    }

    .dash-hero__title {
        font-size: 0.95rem;
    }

    .dash-hero__meta {
        font-size: 9px;
    }

    .dash-hero__actions {
        max-width: 42%;
    }

    .dash-hero__btn {
        padding: 5px 8px;
        font-size: 10px;
        gap: 4px;
    }

    .sidebar__link {
        padding: 14px 16px;
        min-height: 48px;
    }

    .header-bar__toggle {
        min-width: 44px;
        min-height: 44px;
    }

    body.sidebar--collapsed .header-bar__fab-logo {
        display: inline-flex;
    }

    .header-bar--timesheet .header-bar__timesheet-main {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        order: 4;
    }

    .header-bar--timesheet .header-bar__ts-left {
        flex-direction: row;
        flex-wrap: wrap;
        width: 100%;
        justify-content: flex-start;
    }

    .header-bar--timesheet .header-bar__ts-center {
        width: 100%;
        justify-content: center;
    }

    .header-bar--timesheet .header-bar__ts-center .site-name-badge {
        max-width: none;
    }

    .header-bar--timesheet .header-bar__ts-right {
        width: 100%;
        justify-content: stretch;
    }

    .header-bar--timesheet .ts-action-bar .ts-btn {
        flex: 1 1 auto;
    }

    .header-bar--timesheet .ts-btn__lbl {
        display: none;
    }
}

.main-content .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

html {
    height: 100%;
}

@media (max-width: 768px) {
    .search-container button,
    .btn-refresh,
    .btn-page,
    .shift-tab {
        min-height: 44px;
        padding-left: 14px;
        padding-right: 14px;
    }
}

/* —— Dashboard home —— */
.dash-page {
    flex: 1;
    padding: 20px 28px 32px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 0;
    overflow: auto;
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.dash-hero {
    --dash-hero-avatar: 150px;
    background: linear-gradient(135deg, #2d3a66 0%, #3d4f8f 55%, #4a5fa8 100%);
    border-radius: var(--radius-lg, 16px);
    min-height: var(--dash-hero-avatar);
    height: var(--dash-hero-avatar);
    padding: 0 18px 0 0;
    color: #fff;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: flex-start;
    gap: 14px;
    overflow: hidden;
}

.dash-hero__welcome {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1 1 auto;
    height: 100%;
}

.dash-hero__copy {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    padding: 4px 0;
}

.dash-hero__avatar-slot {
    flex-shrink: 0;
    width: var(--dash-hero-avatar);
    height: var(--dash-hero-avatar);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dash-hero__avatar-wrap {
    position: relative;
    width: var(--dash-hero-avatar);
    height: var(--dash-hero-avatar);
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
}

.dash-hero__avatar {
    width: var(--dash-hero-avatar);
    height: var(--dash-hero-avatar);
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: none;
    box-shadow: none;
}

.dash-hero__avatar-initials {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.32) 0%, rgba(255, 255, 255, 0.1) 100%);
    color: #fff;
    font-size: 2.6rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    border: none;
    box-shadow: none;
}

.dash-hero__eyebrow {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0.78;
    margin: 0;
    line-height: 1.2;
}

.dash-hero__greeting {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    opacity: 0.92;
    line-height: 1.2;
    white-space: nowrap;
}

.dash-hero__title {
    font-family: 'Poppins', 'Inter', sans-serif;
    font-size: clamp(1.05rem, 2vw, 1.45rem);
    font-weight: 700;
    margin: 0;
    line-height: 1.1;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: uppercase;
}

.dash-hero__meta {
    font-size: 10px;
    opacity: 0.82;
    margin: 0;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-hero__actions {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    align-items: center;
    align-self: center;
    flex-shrink: 0;
    max-width: 48%;
    overflow-x: auto;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.dash-hero__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 11px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
    text-decoration: none;
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.dash-hero__btn:hover {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

.dash-hero__btn--solid {
    background: #fff;
    color: var(--brand, #3d4f8f);
    border-color: #fff;
}

.dash-hero__btn--solid:hover {
    background: #f0f4fb;
}

.dash-coord-panel {
    background: var(--surface, #fff);
    border: 1px solid var(--border-default, #dbe3f0);
    border-radius: var(--radius-lg, 16px);
    padding: 18px 20px 20px;
    box-shadow: var(--shadow-card);
}

.dash-coord-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.dash-coord-panel__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-heading);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.dash-coord-panel__meta {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

.dash-coord-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.dash-coord-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border-default, #dbe3f0);
    background: #f8fafc;
    min-height: 88px;
}

.dash-coord-card__icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.95rem;
}

.dash-coord-card--blue .dash-coord-card__icon { background: rgba(74, 95, 168, 0.14); color: #3d4f8f; }
.dash-coord-card--teal .dash-coord-card__icon { background: rgba(13, 148, 136, 0.12); color: #0d9488; }
.dash-coord-card--amber .dash-coord-card__icon { background: rgba(217, 119, 6, 0.12); color: #d97706; }
.dash-coord-card--red .dash-coord-card__icon { background: rgba(220, 38, 38, 0.1); color: #dc2626; }
.dash-coord-card--slate .dash-coord-card__icon { background: rgba(100, 116, 139, 0.12); color: #64748b; }

.dash-coord-card__body { min-width: 0; }

.dash-coord-card__label {
    margin: 0;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.dash-coord-card__value {
    margin: 4px 0 0;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-heading);
    line-height: 1.2;
    word-break: break-word;
}

.dash-coord-card__sub {
    margin: 4px 0 0;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.35;
}

.dash-coord-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.dash-coord-quick__btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-default, #dbe3f0);
    background: #fff;
    color: var(--brand, #3d4f8f);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: var(--transition);
}

.dash-coord-quick__btn:hover {
    background: rgba(74, 95, 168, 0.08);
    color: var(--brand-mid, #3d4f8f);
}

.dash-finance-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.dash-period-label {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-muted);
}

.dash-period-input {
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-default);
    background: var(--surface);
    font-size: 13px;
    font-family: inherit;
}

.dash-refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-default, #dbe3f0);
    background: var(--surface, #fff);
    color: var(--brand, #3d4f8f);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
    margin-inline-start: auto;
    flex-shrink: 0;
}

.dash-refresh-btn:hover {
    background: rgba(74, 95, 168, 0.08);
    border-color: rgba(61, 79, 143, 0.28);
}

.dash-online-panel__head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.dash-coord-panel__head .dash-refresh-btn {
    margin-inline-start: 0;
}

.dash-live-badge--pulse {
    animation: dashLivePulse 0.9s ease;
}

@keyframes dashLivePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(74, 95, 168, 0); }
    50% { box-shadow: 0 0 0 6px rgba(74, 95, 168, 0.25); }
}

.dash-finance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
    margin-bottom: 6px;
}

.dash-finance-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 20px 18px;
    border-radius: var(--radius-card);
    border: 1px solid var(--border-default);
    background: var(--surface);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.dash-finance-card::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--primary);
}

.dash-finance-card--salary::before { background: var(--brand-mid, #3d4f8f); }
.dash-finance-card--invoice::before { background: var(--color-success, #059669); }

.dash-finance-card__icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.dash-finance-card--salary .dash-finance-card__icon {
    background: rgba(61, 79, 143, 0.12);
    color: var(--brand-mid, #3d4f8f);
}

.dash-finance-card--invoice .dash-finance-card__icon {
    background: rgba(5, 150, 105, 0.12);
    color: var(--color-success, #059669);
}

.dash-finance-card__body { flex: 1; min-width: 0; }

.dash-finance-card__label {
    margin: 0 0 4px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dash-finance-card__value {
    margin: 0;
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--text-heading);
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
}

.dash-finance-card__sub {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--text-muted);
}

.dash-finance-card__link {
    align-self: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    white-space: nowrap;
}

.dash-finance-card__link:hover { color: var(--primary-hover); }

.dash-site-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.dash-site-filter label {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-muted);
}

.dash-site-filter select {
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-default);
    background: var(--surface);
    font-size: 13px;
    min-width: 160px;
}

.dash-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}

.dash-kpi {
    background: var(--surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-card);
    padding: 18px 18px 16px;
    box-shadow: var(--shadow-card);
    display: flex;
    gap: 14px;
    align-items: flex-start;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dash-kpi:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

.dash-kpi__icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.dash-kpi__icon--blue { background: #e8edf8; color: #3d4f8f; }
.dash-kpi__icon--slate { background: #f1f5f9; color: #475569; }
.dash-kpi__icon--amber { background: #fffbeb; color: #d97706; }
.dash-kpi__icon--red { background: #fef2f2; color: #dc2626; }
.dash-kpi__icon--teal { background: #ecfdf5; color: #0d9488; }

.dash-kpi__body { min-width: 0; }

.dash-kpi__val {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--text-heading);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.dash-kpi__lbl {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.35;
}

.dash-panel {
    background: var(--surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    box-shadow: var(--shadow-card);
}

.dash-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.dash-panel h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-heading);
}

.dash-panel__meta {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.dash-alerts-hint {
    margin: -6px 0 12px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
}

.dash-notify-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dash-notify-list--scroll {
    max-height: min(520px, 60vh);
    overflow-y: auto;
    padding-inline-end: 4px;
}

.dash-notify-section {
    list-style: none;
    margin: 10px 0 4px;
    padding: 0 2px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--brand-mid, #3d4f8f);
}

.dash-notify-section:first-child {
    margin-top: 0;
}

.dash-notify-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-default);
    text-decoration: none;
    color: inherit;
    transition: background 0.15s, border-color 0.15s;
}

.dash-notify-item:hover {
    background: #f8fafc;
    border-color: var(--brand-light, #8b9dd9);
}

.dash-notify-item--high {
    border-color: #fecaca;
    background: #fffafa;
}

.dash-notify-item__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
    background: var(--brand-light, #8b9dd9);
}

.dash-notify-item--high .dash-notify-item__dot {
    background: #dc2626;
}

.dash-notify-item__title {
    font-weight: 700;
    font-size: 13px;
    color: var(--text-heading);
}

.dash-notify-item__detail {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 3px;
}

.dash-empty {
    color: var(--text-muted);
    font-size: 13px;
    margin: 0;
    padding: 12px 0;
    text-align: center;
}

.header-bar--dashboard .header-bar__user-chip {
    display: none !important;
}

.header-bar--dashboard .header-bar__title {
    display: flex !important;
    color: var(--text-heading);
}

.header-bar--dashboard .header-bar__title span {
    font-size: 1.1rem;
}

.dash-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.dash-panel--chart h2 {
    font-size: 14px;
    margin: 0 0 10px;
    color: var(--text-heading);
}

.dash-panel--wide {
    grid-column: 1 / -1;
}

.dash-bar-row {
    display: grid;
    grid-template-columns: 1fr 2fr auto;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
    font-size: 12px;
}

.dash-bar-lbl {
    color: #000000;
    font-weight: 700;
}

.dash-bar-track {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.dash-bar-fill {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #1e3a5f, #3b82f6);
    border-radius: 4px;
}

.dash-health-pre {
    font-size: 11px;
    background: #0f172a;
    color: #e2e8f0;
    padding: 12px;
    border-radius: 8px;
    overflow: auto;
    max-height: 220px;
}

.dash-backups {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}

.dash-backups__title {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 700;
    color: #1f3864;
}

.dash-backups__list {
    margin: 0;
    padding-left: 18px;
    font-size: 12px;
    color: #475569;
    line-height: 1.6;
}

.dash-online-panel {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg, 16px);
    padding: 14px 18px;
    box-shadow: var(--shadow-card, 0 1px 3px rgba(15, 23, 42, 0.08));
}

.dash-online-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.dash-online-panel__title {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: #1f3864;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.dash-online-panel__title i {
    color: #22c55e;
    font-size: 8px;
    animation: dash-online-pulse 2s ease-in-out infinite;
}

@keyframes dash-online-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.dash-online-panel__meta {
    font-size: 11px;
    color: #64748b;
    white-space: nowrap;
}

.dash-online-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.dash-online-chip {
    display: inline-block;
    max-width: 100%;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1.35;
    color: #1e293b;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-online-empty {
    margin: 4px 0 0;
    font-size: 12px;
}
