/* Phase 6.0-R5 — YAZ Fixed Light Mode + Unified Supporting Pages Polish */

/* ثابت لايت مود */
:root {
    color-scheme: light !important;
    --yaz-purple-950: #2A1649;
    --yaz-purple-900: #2A1649;
    --yaz-purple-800: #482A82;
    --yaz-purple-700: #482A82;
    --yaz-purple-600: #482A82;
    --yaz-purple-500: #8b3ff2;
    --yaz-lilac: #C3B3F2;
    --yaz-bg: #F3F0FC;
    --yaz-card: rgba(255,255,255,.92);
    --yaz-text: #141223;
    --yaz-muted: #6E6777;
    --yaz-border: rgba(69,44,139,.11);
    --yaz-shadow: 0 16px 38px rgba(37,26,91,.065);
}

html,
body {
    background:
        radial-gradient(circle at 8% 0%, rgba(195,179,242,.34), transparent 360px),
        radial-gradient(circle at 88% 16%, rgba(91,33,217,.13), transparent 390px),
        linear-gradient(180deg, #F3F0FC 0%, #fbfaff 48%, #F3F0FC 100%) !important;
    color: var(--yaz-text) !important;
}

/* إلغاء فكرة تبديل المظهر من الواجهات */
form[action="/theme/toggle"],
form[action="/my-profile/theme"],
.portal-theme-form,
.theme-toggle,
[data-theme-toggle],
button[name="next_theme_mode"],
input[name="theme_mode"] {
    display: none !important;
}

/* إخفاء كروت اختيار الدارك/لايت داخل صفحة ملفي الشخصي إن وجدت */
label:has(input[name="theme_mode"]),
.card:has(input[name="theme_mode"]),
.glass.card:has(input[name="theme_mode"]) {
    display: none !important;
}

/* الصفحات الداعمة فقط */
body:has(.health-title),
body:has(.notification-item),
body:has(.compact-stats),
body:has(.employees-title),
body:has(.employee-edit-hero),
body:has(.yaz-page-title),
body:has(form[action="/my-profile/theme"]) {
    background:
        radial-gradient(circle at 8% 0%, rgba(195,179,242,.34), transparent 360px),
        radial-gradient(circle at 88% 16%, rgba(91,33,217,.13), transparent 390px),
        linear-gradient(180deg, #F3F0FC 0%, #fbfaff 48%, #F3F0FC 100%) !important;
    color: var(--yaz-text) !important;
    font-family: "IBM Plex Sans Arabic", "Tajawal", Arial, sans-serif !important;
}

/* عرض موحد */
body:has(.health-title) .container,
body:has(.notification-item) .container,
body:has(.compact-stats) .container,
body:has(.employees-title) .container,
body:has(.employee-edit-hero) .container,
body:has(.yaz-page-title) .container,
body:has(form[action="/my-profile/theme"]) .container,
body:has(.health-title) main,
body:has(.notification-item) main,
body:has(.compact-stats) main,
body:has(.employees-title) main,
body:has(.employee-edit-hero) main,
body:has(.yaz-page-title) main,
body:has(form[action="/my-profile/theme"]) main,
body:has(.health-title) .wrap,
body:has(.notification-item) .wrap,
body:has(.compact-stats) .wrap,
body:has(.employees-title) .wrap,
body:has(.employee-edit-hero) .wrap,
body:has(.yaz-page-title) .wrap,
body:has(form[action="/my-profile/theme"]) .wrap {
    width: min(1500px, calc(100% - 56px)) !important;
    max-width: 1500px !important;
    margin-inline: auto !important;
}

/* الهيدر الموحد */
body:has(.health-title) .topbar,
body:has(.notification-item) .topbar,
body:has(.compact-stats) .topbar,
body:has(.employees-title) .topbar,
body:has(.employee-edit-hero) .topbar,
body:has(.yaz-page-title) .topbar,
body:has(form[action="/my-profile/theme"]) .topbar {
    width: min(1500px, calc(100% - 56px)) !important;
    min-height: 76px !important;
    margin: 22px auto 22px !important;
    padding: 14px 22px !important;
    border-radius: 28px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 18px !important;
    background:
        radial-gradient(circle at 14% 0%, rgba(195,179,242,.22), transparent 280px),
        linear-gradient(135deg, #2A1649 0%, #2A1649 50%, #482A82 100%) !important;
    border: 1px solid rgba(255,255,255,.14) !important;
    box-shadow: 0 20px 48px rgba(32,14,86,.22) !important;
}

body:has(.health-title) .topbar h1,
body:has(.notification-item) .topbar h1,
body:has(.compact-stats) .topbar h1,
body:has(.employees-title) .topbar h1,
body:has(.employee-edit-hero) .topbar h1,
body:has(.yaz-page-title) .topbar h1,
body:has(form[action="/my-profile/theme"]) .topbar h1 {
    margin: 0 !important;
    color: #ffffff !important;
    font-size: 24px !important;
    font-weight: 950 !important;
    letter-spacing: -.3px !important;
}

body:has(.health-title) .topbar p,
body:has(.notification-item) .topbar p,
body:has(.compact-stats) .topbar p,
body:has(.employees-title) .topbar p,
body:has(.employee-edit-hero) .topbar p,
body:has(.yaz-page-title) .topbar p,
body:has(form[action="/my-profile/theme"]) .topbar p {
    color: rgba(255,255,255,.78) !important;
    font-size: 12px !important;
    font-weight: 800 !important;
    margin-top: 4px !important;
}

body:has(.health-title) .topbar .btn,
body:has(.notification-item) .topbar .btn,
body:has(.compact-stats) .topbar .btn,
body:has(.employees-title) .topbar .btn,
body:has(.employee-edit-hero) .topbar .btn,
body:has(.yaz-page-title) .topbar .btn,
body:has(form[action="/my-profile/theme"]) .topbar .btn,
body:has(.health-title) .topbar a,
body:has(.notification-item) .topbar a,
body:has(.compact-stats) .topbar a,
body:has(.employees-title) .topbar a,
body:has(.employee-edit-hero) .topbar a,
body:has(.yaz-page-title) .topbar a,
body:has(form[action="/my-profile/theme"]) .topbar a {
    min-height: 42px !important;
    padding: 0 15px !important;
    border-radius: 15px !important;
    color: #ffffff !important;
    background: rgba(255,255,255,.10) !important;
    border: 1px solid rgba(255,255,255,.18) !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    font-size: 12px !important;
    font-weight: 950 !important;
}

/* الكروت العامة */
body:has(.health-title) .glass.card,
body:has(.notification-item) .glass.card,
body:has(.compact-stats) .glass.card,
body:has(.employees-title) .glass.card,
body:has(.employee-edit-hero) .glass.card,
body:has(.yaz-page-title) .glass.card,
body:has(form[action="/my-profile/theme"]) .glass.card,
body:has(.health-title) .card,
body:has(.notification-item) .card,
body:has(.compact-stats) .card,
body:has(.employees-title) .card,
body:has(.employee-edit-hero) .card,
body:has(.yaz-page-title) .card,
body:has(form[action="/my-profile/theme"]) .card {
    border-radius: 24px !important;
    background:
        radial-gradient(circle at 12% 8%, rgba(195,179,242,.12), transparent 170px),
        var(--yaz-card) !important;
    border: 1px solid var(--yaz-border) !important;
    box-shadow: var(--yaz-shadow) !important;
    color: var(--yaz-text) !important;
}

/* العناوين */
.health-title,
.employees-title,
.yaz-page-title,
body:has(.notification-item) .compact-section h2,
body:has(form[action="/my-profile/theme"]) h1,
body:has(form[action="/my-profile/theme"]) h2 {
    color: var(--yaz-text) !important;
    font-weight: 950 !important;
    letter-spacing: -.5px !important;
}

.muted,
.health-note,
.health-label,
label,
small {
    color: var(--yaz-muted) !important;
}

/* الأزرار */
.btn,
a.btn,
button.btn {
    border-radius: 14px !important;
    min-height: 40px !important;
    font-weight: 950 !important;
}

.btn-primary,
button.btn-primary,
a.btn-primary {
    background: linear-gradient(135deg, #482A82, #6C57A6) !important;
    color: #ffffff !important;
    border-color: transparent !important;
    box-shadow: 0 14px 30px rgba(109,40,217,.22) !important;
}

.btn-ghost,
a.btn-ghost,
button.btn-ghost {
    color: #482A82 !important;
    background: rgba(255,255,255,.82) !important;
    border: 1px solid rgba(109,40,217,.14) !important;
}

/* الشارات */
.status-badge,
.health-status,
.status,
.badge {
    min-height: 28px !important;
    padding: 5px 12px !important;
    border-radius: 999px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 11px !important;
    font-weight: 950 !important;
    border: 1px solid transparent !important;
}

.status-success,
.health-ok,
.ok {
    color: #1F7A55 !important;
    background: #eaf9ef !important;
    border-color: rgba(22,163,74,.14) !important;
}

.status-warning,
.health-warning,
.warning {
    color: #B86E12 !important;
    background: #fff7ed !important;
    border-color: rgba(194,65,12,.14) !important;
}

.status-danger,
.health-danger,
.danger {
    color: #B42335 !important;
    background: #fff1f2 !important;
    border-color: rgba(190,18,60,.14) !important;
}

.status-info,
.health-info {
    color: #482A82 !important;
    background: #EAE9F9 !important;
    border-color: rgba(109,40,217,.13) !important;
}

/* صفحة صحة النظام — إلغاء الفراغ والدرع الكبير */
body:has(.health-title) .glass.card:first-of-type {
    min-height: 220px !important;
    padding: 30px 34px !important;
    border-radius: 32px !important;
    display: grid !important;
    align-content: center !important;
    overflow: hidden !important;
    background:
        radial-gradient(circle at 18% 28%, rgba(195,179,242,.25), transparent 320px),
        linear-gradient(135deg, rgba(255,255,255,.94), rgba(247,243,255,.88)) !important;
}

body:has(.health-title) .glass.card:first-of-type:before,
body:has(.health-title) .glass.card:first-of-type:after {
    display: none !important;
}

body:has(.health-title) .health-title {
    font-size: clamp(32px, 3vw, 46px) !important;
    max-width: 860px !important;
    margin-inline-start: auto !important;
}

body:has(.health-title) .health-title + p,
body:has(.health-title) .health-title ~ p {
    max-width: 860px !important;
    margin-inline-start: auto !important;
    font-size: 14px !important;
    line-height: 1.85 !important;
}

body:has(.health-title) .grid-4 {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 14px !important;
}

body:has(.health-title) .grid-4 > .glass.card,
body:has(.health-title) .grid-4 > .card {
    min-height: 120px !important;
    padding: 18px !important;
}

body:has(.health-title) .health-card,
body:has(.health-title) .health-section {
    min-height: auto !important;
}

/* صفحة التنبيهات */
body:has(.notification-item) .compact-stats {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 16px !important;
}

body:has(.notification-item) .compact-stats .glass.card {
    min-height: 112px !important;
    padding: 20px !important;
    position: relative !important;
    overflow: hidden !important;
}

body:has(.notification-item) .compact-stats .glass.card:before {
    content: "•";
    position: absolute;
    left: 18px;
    bottom: 18px;
    width: 46px;
    height: 46px;
    border-radius: 17px;
    display: grid;
    place-items: center;
    color: #482A82;
    font-size: 26px;
    line-height: 1;
    background:
        radial-gradient(circle at 30% 20%, rgba(255,255,255,.88), transparent 45%),
        linear-gradient(135deg, rgba(109,40,217,.12), rgba(168,85,247,.18));
    border: 1px solid rgba(109,40,217,.10);
}

body:has(.notification-item) .compact-stats .glass.card:nth-child(1):before { content: "🔔"; font-size: 20px; }
body:has(.notification-item) .compact-stats .glass.card:nth-child(2):before { content: "●"; font-size: 22px; }
body:has(.notification-item) .compact-stats .glass.card:nth-child(3):before { content: "⚠"; font-size: 20px; }
body:has(.notification-item) .compact-stats .glass.card:nth-child(4):before { content: "﷼"; font-size: 18px; font-weight: 950; }

body:has(.notification-item) .compact-section {
    padding: 24px !important;
    border-radius: 30px !important;
    background:
        radial-gradient(circle at 16% 18%, rgba(195,179,242,.14), transparent 260px),
        rgba(255,255,255,.92) !important;
}

body:has(.notification-item) .compact-section:first-of-type:after {
    display: none !important;
}

body:has(.notification-item) .notification-item {
    min-height: 112px !important;
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    gap: 18px !important;
    align-items: center !important;
    padding: 18px 20px !important;
    border-radius: 24px !important;
    background:
        linear-gradient(135deg, rgba(255,255,255,.96), rgba(249,247,255,.92)) !important;
    border: 1px solid rgba(109,40,217,.13) !important;
    box-shadow: 0 12px 30px rgba(37,26,91,.055) !important;
}

body:has(.notification-item) .notification-item:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 18px 36px rgba(37,26,91,.08) !important;
}

body:has(.notification-item) .notification-item .btn,
body:has(.notification-item) .notification-item button {
    min-width: 120px !important;
    min-height: 44px !important;
}

/* ملفي الشخصي */
body:has(form[action="/my-profile/theme"]) .glass.card {
    padding: 20px !important;
}

body:has(form[action="/my-profile/theme"]) .grid-4 {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 14px !important;
}

/* إعدادات النظام */
body:has(.yaz-page-title) .yaz-page-title {
    font-size: clamp(28px, 2.6vw, 40px) !important;
}

body:has(.yaz-page-title) input,
body:has(.yaz-page-title) textarea,
body:has(.yaz-page-title) select,
body:has(.employees-title) input,
body:has(.employees-title) textarea,
body:has(.employees-title) select,
body:has(.employee-edit-hero) input,
body:has(.employee-edit-hero) textarea,
body:has(.employee-edit-hero) select {
    border-radius: 14px !important;
    background: rgba(255,255,255,.92) !important;
    border: 1px solid rgba(69,44,139,.12) !important;
    color: #141223 !important;
}

/* إدارة المستخدمين */
body:has(.employees-title) .employees-title {
    font-size: clamp(28px, 2.6vw, 40px) !important;
}

body:has(.employees-title) table,
body:has(.employee-edit-hero) table {
    width: 100% !important;
    border-collapse: collapse !important;
    border-radius: 18px !important;
    overflow: hidden !important;
}

body:has(.employees-title) th,
body:has(.employees-title) td,
body:has(.employee-edit-hero) th,
body:has(.employee-edit-hero) td,
body:has(.health-title) th,
body:has(.health-title) td {
    padding: 12px !important;
    text-align: right !important;
    border-bottom: 1px solid rgba(69,44,139,.08) !important;
}

body:has(.employees-title) th,
body:has(.employee-edit-hero) th,
body:has(.health-title) th {
    color: #6b607d !important;
    background: #f4efff !important;
    font-weight: 950 !important;
}

body:has(.employees-title) td,
body:has(.employee-edit-hero) td,
body:has(.health-title) td {
    color: #141223 !important;
    background: rgba(255,255,255,.82) !important;
    font-weight: 850 !important;
}

/* سجلات/أكواد */
pre,
code {
    direction: ltr !important;
    text-align: left !important;
    border-radius: 16px !important;
    background: #141223 !important;
    color: #f8f5ff !important;
    border: 1px solid rgba(255,255,255,.08) !important;
}

/* الفوتر */
footer,
.footer,
.yaz-footer {
    background: rgba(255,255,255,.62) !important;
    border-top: 1px solid rgba(69,44,139,.07) !important;
    color: #6b607d !important;
}

/* تجاوب */
@media (max-width: 1100px) {
    body:has(.health-title) .grid-4,
    body:has(.notification-item) .compact-stats,
    body:has(form[action="/my-profile/theme"]) .grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    body:has(.notification-item) .notification-item {
        grid-template-columns: 1fr !important;
    }

    body:has(.health-title) .topbar,
    body:has(.notification-item) .topbar,
    body:has(.compact-stats) .topbar,
    body:has(.employees-title) .topbar,
    body:has(.employee-edit-hero) .topbar,
    body:has(.yaz-page-title) .topbar,
    body:has(form[action="/my-profile/theme"]) .topbar {
        display: grid !important;
    }
}

@media (max-width: 700px) {
    body:has(.health-title) .container,
    body:has(.notification-item) .container,
    body:has(.compact-stats) .container,
    body:has(.employees-title) .container,
    body:has(.employee-edit-hero) .container,
    body:has(.yaz-page-title) .container,
    body:has(form[action="/my-profile/theme"]) .container,
    body:has(.health-title) main,
    body:has(.notification-item) main,
    body:has(.compact-stats) main,
    body:has(.employees-title) main,
    body:has(.employee-edit-hero) main,
    body:has(.yaz-page-title) main,
    body:has(form[action="/my-profile/theme"]) main,
    body:has(.health-title) .wrap,
    body:has(.notification-item) .wrap,
    body:has(.compact-stats) .wrap,
    body:has(.employees-title) .wrap,
    body:has(.employee-edit-hero) .wrap,
    body:has(.yaz-page-title) .wrap,
    body:has(form[action="/my-profile/theme"]) .wrap,
    body:has(.health-title) .topbar,
    body:has(.notification-item) .topbar,
    body:has(.compact-stats) .topbar,
    body:has(.employees-title) .topbar,
    body:has(.employee-edit-hero) .topbar,
    body:has(.yaz-page-title) .topbar,
    body:has(form[action="/my-profile/theme"]) .topbar {
        width: calc(100% - 28px) !important;
    }

    body:has(.health-title) .grid-4,
    body:has(.notification-item) .compact-stats,
    body:has(form[action="/my-profile/theme"]) .grid-4 {
        grid-template-columns: 1fr !important;
    }
}

/* Phase 6.0-R6 — Global Portal UX Corrections */

/* Light mode is the only supported UI mode */
html,
body {
    color-scheme: light !important;
}

/* Remove all theme toggles visually */
form[action="/theme/toggle"],
form[action="/my-profile/theme"],
.portal-theme-form,
.theme-toggle,
[data-theme-toggle],
button[name="next_theme_mode"],
input[name="theme_mode"],
label:has(input[name="theme_mode"]),
.card:has(input[name="theme_mode"]),
.glass.card:has(input[name="theme_mode"]) {
    display: none !important;
}

/* Unified spacing: same as main portal */
body:has(.portal-shell) .portal-topbar,
body:has(.health-title) .topbar,
body:has(.notification-item) .topbar,
body:has(.compact-stats) .topbar,
body:has(.employees-title) .topbar,
body:has(.employee-edit-hero) .topbar,
body:has(.yaz-page-title) .topbar {
    width: min(1500px, calc(100% - 32px)) !important;
    margin: 14px auto 18px !important;
    min-height: 78px !important;
    border-radius: 28px !important;
}

/* Fix black title contrast in portal header */
.portal-topbar .portal-brand,
.portal-topbar .portal-brand *,
.portal-topbar .portal-brand-text h1,
.portal-topbar .portal-brand-text p,
body:has(.portal-shell) .portal-brand-text h1,
body:has(.portal-shell) .portal-brand-text p {
    color: #ffffff !important;
}

/* Remove logo square/container look */
.portal-logo,
.health-logo,
.topbar .health-logo,
.topbar [class*="logo"],
.portal-topbar [class*="logo"] {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

.portal-logo {
    width: 58px !important;
    height: 58px !important;
    padding: 0 !important;
    border-radius: 0 !important;
}

.portal-logo img,
.topbar img,
.portal-topbar img {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    object-fit: contain !important;
}

/* Global user menu */
.yaz-user-menu {
    position: relative;
    z-index: 9999;
    display: inline-flex;
    align-items: center;
}

.yaz-user-menu-btn {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    color: #ffffff;
    cursor: pointer;
    background: rgba(255,255,255,.11);
    border: 1px solid rgba(255,255,255,.20);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.15),
        0 10px 22px rgba(0,0,0,.08);
}

.yaz-user-menu-btn svg {
    width: 22px;
    height: 22px;
}

.yaz-user-menu-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: 210px;
    padding: 8px;
    border-radius: 18px;
    background: rgba(255,255,255,.96);
    border: 1px solid rgba(69,44,139,.12);
    box-shadow: 0 24px 48px rgba(37,26,91,.18);
    display: none;
}

.yaz-user-menu.open .yaz-user-menu-dropdown {
    display: grid;
    gap: 6px;
}

.yaz-user-menu-dropdown a {
    min-height: 42px !important;
    padding: 0 12px !important;
    border-radius: 13px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    color: #141223 !important;
    background: transparent !important;
    border: 0 !important;
    text-decoration: none !important;
    font-size: 13px !important;
    font-weight: 900 !important;
}

.yaz-user-menu-dropdown a:hover {
    background: #EAE9F9 !important;
    color: #482A82 !important;
}

.yaz-user-menu-dropdown a.danger {
    color: #B42335 !important;
}

.yaz-user-menu-dropdown a.danger:hover {
    background: #fff1f2 !important;
}

/* Remove duplicated profile quick/card remains if any */
.portal-quick-grid a[href="/my-profile"],
.portal-card a[href="/my-profile"],
.portal-small-card a[href="/my-profile"],
.portal-card:has(a[href="/my-profile"]),
.portal-small-card:has(a[href="/my-profile"]) {
    display: none !important;
}

/* Portal stat wording and visual cleanup */
.portal-stat-card {
    background: rgba(255,255,255,.92) !important;
    border: 1px solid rgba(69,44,139,.10) !important;
}

.portal-stat-copy small {
    color: #81758f !important;
    font-weight: 950 !important;
}

.portal-stat-copy strong {
    color: #141223 !important;
}

/* Notification statistics: real visible icons */
body:has(.notification-item) .compact-stats .glass.card {
    position: relative !important;
    overflow: hidden !important;
}

body:has(.notification-item) .compact-stats .glass.card:before {
    background:
        radial-gradient(circle at 30% 20%, rgba(255,255,255,.88), transparent 45%),
        linear-gradient(135deg, rgba(109,40,217,.13), rgba(168,85,247,.20)) !important;
}

body:has(.notification-item) .compact-stats .glass.card:after {
    position: absolute;
    left: 29px;
    bottom: 29px;
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    color: #482A82 !important;
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", Arial, sans-serif !important;
    font-size: 21px;
    font-weight: 900;
    line-height: 1;
    z-index: 2;
}

body:has(.notification-item) .compact-stats .glass.card:nth-child(1):after { content: "🔔"; }
body:has(.notification-item) .compact-stats .glass.card:nth-child(2):after { content: "●"; color: #C9820F !important; }
body:has(.notification-item) .compact-stats .glass.card:nth-child(3):after { content: "⚠"; color: #1F7A55 !important; }
body:has(.notification-item) .compact-stats .glass.card:nth-child(4):after { content: "﷼"; color: #B86E12 !important; }

/* Health page: remove huge empty shield area and improve log contrast */
body:has(.health-title) .glass.card:first-of-type:before,
body:has(.health-title) .glass.card:first-of-type:after {
    display: none !important;
}

body:has(.health-title) .glass.card:first-of-type {
    min-height: 210px !important;
}

body:has(.health-title) pre,
body:has(.health-title) code,
body:has(.health-title) textarea[readonly] {
    background: #141223 !important;
    color: #f8f5ff !important;
    border: 1px solid rgba(255,255,255,.10) !important;
}

/* Footer generalized like notifications footer */
body:has(.portal-shell) footer,
body:has(.health-title) footer,
body:has(.notification-item) footer,
body:has(.compact-stats) footer,
body:has(.employees-title) footer,
body:has(.employee-edit-hero) footer,
body:has(.yaz-page-title) footer,
body:has(.portal-shell) .footer,
body:has(.health-title) .footer,
body:has(.notification-item) .footer,
body:has(.compact-stats) .footer,
body:has(.employees-title) .footer,
body:has(.employee-edit-hero) .footer,
body:has(.yaz-page-title) .footer,
body:has(.portal-shell) .yaz-footer,
body:has(.health-title) .yaz-footer,
body:has(.notification-item) .yaz-footer,
body:has(.compact-stats) .yaz-footer,
body:has(.employees-title) .yaz-footer,
body:has(.employee-edit-hero) .yaz-footer,
body:has(.yaz-page-title) .yaz-footer {
    width: min(1500px, calc(100% - 32px)) !important;
    margin: 28px auto 20px !important;
    padding: 17px 22px !important;
    border-radius: 22px !important;
    background: rgba(255,255,255,.72) !important;
    border: 1px solid rgba(69,44,139,.10) !important;
    color: #23213A !important;
    box-shadow: 0 12px 26px rgba(37,26,91,.04) !important;
}

body:has(.portal-shell) footer *,
body:has(.health-title) footer *,
body:has(.notification-item) footer *,
body:has(.compact-stats) footer *,
body:has(.employees-title) footer *,
body:has(.employee-edit-hero) footer *,
body:has(.yaz-page-title) footer * {
    color: #23213A !important;
}

/* Stronger topbar buttons contrast */
.portal-topbar a,
.portal-topbar button,
.topbar a,
.topbar button {
    color: #ffffff !important;
}

/* Mobile */
@media (max-width: 760px) {
    .yaz-user-menu-dropdown {
        left: auto;
        right: 0;
    }
}

/* Phase 6.0-R7 — Final Strong UX Corrections */

/* Fixed light only */
html, body {
    color-scheme: light !important;
}

/* Universal header width/spacing like portal */
.portal-topbar,
body:not(:has(.erp-shell)) .topbar {
    width: min(1500px, calc(100% - 32px)) !important;
    margin: 14px auto 18px !important;
    min-height: 78px !important;
    border-radius: 28px !important;
}

/* Force portal brand text to white */
html body .portal-shell .portal-topbar .portal-brand-text h1,
html body .portal-shell .portal-topbar .portal-brand-text p,
html body .portal-shell .portal-topbar .portal-brand,
html body .portal-shell .portal-topbar .portal-brand * {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    text-shadow: none !important;
}

/* Remove role badge everywhere */
.portal-header-actions > *:not(.yaz-user-menu):not(a):not(button),
.topbar a:has(:only-child),
.topbar .btn:empty {
    display: none !important;
}

/* But keep actual user menu */
.yaz-user-menu {
    position: relative !important;
    z-index: 99999 !important;
    display: inline-flex !important;
    align-items: center !important;
}

.yaz-user-menu-btn {
    width: 46px !important;
    height: 46px !important;
    border-radius: 16px !important;
    display: grid !important;
    place-items: center !important;
    color: #ffffff !important;
    cursor: pointer !important;
    background: rgba(255,255,255,.11) !important;
    border: 1px solid rgba(255,255,255,.20) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 10px 22px rgba(0,0,0,.08) !important;
}

.yaz-user-menu-btn svg {
    width: 22px !important;
    height: 22px !important;
}

.yaz-user-menu-dropdown {
    position: absolute !important;
    top: calc(100% + 10px) !important;
    left: 0 !important;
    width: 220px !important;
    padding: 8px !important;
    border-radius: 18px !important;
    background: rgba(255,255,255,.98) !important;
    border: 1px solid rgba(69,44,139,.12) !important;
    box-shadow: 0 24px 48px rgba(37,26,91,.18) !important;
    display: none !important;
}

.yaz-user-menu.open .yaz-user-menu-dropdown {
    display: grid !important;
    gap: 6px !important;
}

.yaz-user-menu-dropdown a {
    min-height: 42px !important;
    padding: 0 12px !important;
    border-radius: 13px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    color: #141223 !important;
    background: transparent !important;
    border: 0 !important;
    text-decoration: none !important;
    font-size: 13px !important;
    font-weight: 900 !important;
}

.yaz-user-menu-dropdown a:hover {
    background: #EAE9F9 !important;
    color: #482A82 !important;
}

.yaz-user-menu-dropdown a.danger {
    color: #B42335 !important;
}

/* Hide old profile/logout/theme controls outside dropdown */
.portal-theme-form,
form[action="/theme/toggle"],
form[action="/my-profile/theme"],
.theme-toggle,
[data-theme-toggle],
button[name="next_theme_mode"],
input[name="theme_mode"],
label:has(input[name="theme_mode"]),
.card:has(input[name="theme_mode"]),
.glass.card:has(input[name="theme_mode"]) {
    display: none !important;
}

.portal-header-actions > a[href="/my-profile"],
.portal-header-actions > a[href="/logout"],
.topbar > div a[href="/my-profile"],
.topbar > div a[href="/logout"] {
    display: none !important;
}

/* Logo without visible box */
.portal-logo,
.health-logo,
.topbar [class*="logo"],
.portal-topbar [class*="logo"] {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

.portal-logo img,
.topbar img,
.portal-topbar img {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    object-fit: contain !important;
}

/* Portal module layout after removing profile */
.portal-primary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

.portal-card:has(a[href="/my-profile"]),
.portal-small-card:has(a[href="/my-profile"]),
.portal-quick-grid a[href="/my-profile"] {
    display: none !important;
}

/* Footer unified */
.yaz-footer,
.yaz-portal-footer,
footer,
.footer {
    width: min(1500px, calc(100% - 32px)) !important;
    margin: 28px auto 20px !important;
    padding: 17px 22px !important;
    border-radius: 22px !important;
    background: rgba(255,255,255,.72) !important;
    border: 1px solid rgba(69,44,139,.10) !important;
    color: #23213A !important;
    box-shadow: 0 12px 26px rgba(37,26,91,.04) !important;
    display: flex !important;
    justify-content: space-between !important;
    gap: 12px !important;
    align-items: center !important;
    flex-wrap: wrap !important;
}

.yaz-footer *,
.yaz-portal-footer *,
footer *,
.footer * {
    color: #23213A !important;
}

/* Modern notification SVG icons instead of emoji */
body:has(.notification-item) .compact-stats .glass.card:after {
    content: "" !important;
    position: absolute !important;
    left: 30px !important;
    bottom: 30px !important;
    width: 24px !important;
    height: 24px !important;
    background-color: #482A82 !important;
    background-image: none !important;
    z-index: 2 !important;
}

body:has(.notification-item) .compact-stats .glass.card:nth-child(1):after {
    -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M18 8a6 6 0 10-12 0c0 7-3 7-3 9h18c0-2-3-2-3-9z' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M13.7 21a2 2 0 01-3.4 0' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat !important;
    mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M18 8a6 6 0 10-12 0c0 7-3 7-3 9h18c0-2-3-2-3-9z' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M13.7 21a2 2 0 01-3.4 0' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat !important;
}

body:has(.notification-item) .compact-stats .glass.card:nth-child(2):after {
    background-color: #C9820F !important;
    border-radius: 999px !important;
    width: 16px !important;
    height: 16px !important;
    left: 34px !important;
    bottom: 34px !important;
}

body:has(.notification-item) .compact-stats .glass.card:nth-child(3):after {
    background-color: #1F7A55 !important;
    -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 3l10 18H2L12 3z' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M12 9v5M12 17h.01' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat !important;
    mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 3l10 18H2L12 3z' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M12 9v5M12 17h.01' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat !important;
}

body:has(.notification-item) .compact-stats .glass.card:nth-child(4):after {
    background-color: #B86E12 !important;
    -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 7h8M8 12h8M8 17h6' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M6 3h12a2 2 0 012 2v14a2 2 0 01-2 2H6a2 2 0 01-2-2V5a2 2 0 012-2z' fill='none' stroke='black' stroke-width='2'/%3E%3C/svg%3E") center / contain no-repeat !important;
    mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 7h8M8 12h8M8 17h6' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M6 3h12a2 2 0 012 2v14a2 2 0 01-2 2H6a2 2 0 01-2-2V5a2 2 0 012-2z' fill='none' stroke='black' stroke-width='2'/%3E%3C/svg%3E") center / contain no-repeat !important;
}

/* Health page header user menu and less huge hero */
body:has(.health-title) .glass.card:first-of-type,
body:has(.health-title) .health-hero {
    min-height: 200px !important;
}

body:has(.health-title) .glass.card:first-of-type:before,
body:has(.health-title) .glass.card:first-of-type:after,
body:has(.health-title) .health-hero:before,
body:has(.health-title) .health-hero:after {
    display: none !important;
}

/* Mobile */
@media (max-width: 760px) {
    .yaz-user-menu-dropdown {
        left: auto !important;
        right: 0 !important;
    }

    .yaz-footer,
    .yaz-portal-footer,
    footer,
    .footer {
        display: grid !important;
    }
}
