:root {
    --gm-primary: #526d64;
    --gm-primary-strong: #3f574f;
    --gm-primary-soft: #e9efec;
    --gm-accent: #8f6f78;
    --gm-accent-soft: #f3eaed;
    --gm-bg: #f7f8f6;
    --gm-surface: #ffffff;
    --gm-surface-muted: #f1f3f0;
    --gm-text: #26332f;
    --gm-muted: #74817c;
    --gm-border: #dfe5e1;
    --gm-danger: #b45f64;
    --gm-warning: #ad7b3d;
    --gm-success: #568066;
    --gm-info: #5c7489;
    --gm-sidebar: #263a34;
    --gm-sidebar-2: #314941;
    --gm-radius: 18px;
    --gm-radius-sm: 12px;
    --gm-shadow: 0 12px 32px rgba(42, 61, 54, .07);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: 'Tajawal', sans-serif !important;
    color: var(--gm-text);
    background: var(--gm-bg);
    min-height: 100vh;
}
a { color: var(--gm-primary-strong); text-decoration: none; }
a:hover { color: var(--gm-accent); }

.app-shell { min-height: 100vh; }
.app-sidebar {
    position: fixed; top: 0; right: 0; bottom: 0; width: 278px;
    background: var(--gm-sidebar);
    color: #fff; z-index: 1040; display: flex; flex-direction: column;
    border-left: 1px solid rgba(255,255,255,.08);
    transition: transform .25s ease;
}
.brand-box { padding: 24px 22px 18px; display: flex; align-items: center; gap: 13px; }
.brand-mark {
    width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center;
    background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.12);
    font-size: 20px;
}
.brand-title { font-size: 17px; font-weight: 800; line-height: 1.25; }
.brand-subtitle { font-size: 11px; color: rgba(255,255,255,.58); margin-top: 4px; }
.sidebar-scroll { overflow-y: auto; padding: 6px 14px 22px; flex: 1; }
.sidebar-section { color: rgba(255,255,255,.44); font-size: 10px; font-weight: 800; letter-spacing: .5px; padding: 18px 12px 8px; }
.sidebar-link {
    display: flex; align-items: center; gap: 12px; color: rgba(255,255,255,.72);
    padding: 11px 12px; border-radius: 13px; margin: 3px 0; font-size: 13px; font-weight: 600;
    transition: .2s ease;
}
.sidebar-link i { width: 25px; height: 25px; display: grid; place-items: center; font-size: 14px; color: #bfd0c8; }
.sidebar-link:hover { color: #fff; background: rgba(255,255,255,.07); transform: translateX(-2px); }
.sidebar-link.active { color: #fff; background: rgba(255,255,255,.12); box-shadow: inset -3px 0 var(--gm-accent); }
.sidebar-badge { margin-right: auto; min-width: 21px; height: 21px; border-radius: 10px; display: grid; place-items: center; background: var(--gm-accent); font-size: 10px; }
.sidebar-footer { padding: 15px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-footer button { width: 100%; border: 0; border-radius: 12px; padding: 11px; background: rgba(180,95,100,.14); color: #ffdadd; font-weight: 700; }

.app-main { margin-right: 278px; min-height: 100vh; }
.app-header {
    height: 78px; position: sticky; top: 0; z-index: 1020; display: flex; align-items: center;
    justify-content: space-between; padding: 0 28px; background: rgba(247,248,246,.94);
    backdrop-filter: blur(14px); border-bottom: 1px solid var(--gm-border);
}
.header-title { font-weight: 800; font-size: 17px; margin: 0; }
.header-meta { color: var(--gm-muted); font-size: 12px; margin-top: 3px; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.icon-button { width: 42px; height: 42px; border-radius: 13px; border: 1px solid var(--gm-border); background: var(--gm-surface); color: var(--gm-text); display: grid; place-items: center; position: relative; }
.icon-button:hover { background: var(--gm-primary-soft); color: var(--gm-primary-strong); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 14px; background: var(--gm-surface); border: 1px solid var(--gm-border); }
.user-avatar { width: 35px; height: 35px; border-radius: 11px; display: grid; place-items: center; color: #fff; background: var(--gm-primary); font-weight: 800; }
.user-name { font-size: 12px; font-weight: 800; }
.user-unit { font-size: 10px; color: var(--gm-muted); max-width: 210px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-content { padding: 28px; }
.mobile-toggle { display: none; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(20,30,27,.45); z-index: 1030; }

.page-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 22px; }
.page-title { margin: 0; font-size: 24px; font-weight: 900; color: var(--gm-text); }
.page-description { margin: 5px 0 0; color: var(--gm-muted); font-size: 13px; }

.card, .glass-card, .stat-card, .premium-card {
    background: var(--gm-surface) !important; border: 1px solid var(--gm-border) !important;
    border-radius: var(--gm-radius) !important; box-shadow: var(--gm-shadow) !important;
}
.card-header { background: transparent !important; border-bottom: 1px solid var(--gm-border) !important; }
.rounded-4 { border-radius: var(--gm-radius) !important; }
.shadow-sm, .shadow-lg, .shadow-3d { box-shadow: var(--gm-shadow) !important; }

.form-label { color: var(--gm-text); font-size: 12px; font-weight: 800 !important; margin-bottom: 7px; }
.form-control, .form-select, .modern-input {
    border: 1px solid var(--gm-border) !important; border-radius: var(--gm-radius-sm) !important;
    min-height: 44px; color: var(--gm-text) !important; background-color: #fff !important;
    box-shadow: none !important; font-size: 13px;
}
textarea.form-control { min-height: auto; }
.form-control:focus, .form-select:focus { border-color: var(--gm-primary) !important; box-shadow: 0 0 0 3px rgba(82,109,100,.10) !important; }
.form-text { color: var(--gm-muted); }

.btn { border-radius: 12px; font-weight: 700; font-size: 13px; padding: .62rem 1rem; }
.btn-primary, .btn-save-royal, .btn-gradient-ocean { background: var(--gm-primary) !important; border-color: var(--gm-primary) !important; color: #fff !important; }
.btn-primary:hover, .btn-save-royal:hover, .btn-gradient-ocean:hover { background: var(--gm-primary-strong) !important; border-color: var(--gm-primary-strong) !important; }
.btn-outline-primary { color: var(--gm-primary-strong); border-color: var(--gm-primary); }
.btn-outline-primary:hover { background: var(--gm-primary); border-color: var(--gm-primary); }
.btn-danger { background: var(--gm-danger); border-color: var(--gm-danger); }
.btn-light { background: var(--gm-surface-muted); border-color: var(--gm-border); color: var(--gm-text); }

.table { --bs-table-bg: transparent; color: var(--gm-text); margin-bottom: 0; }
.table thead th { color: var(--gm-muted); font-size: 11px; font-weight: 800; border-bottom: 1px solid var(--gm-border); background: var(--gm-surface-muted); padding: 13px 12px; white-space: nowrap; }
.table tbody td { padding: 13px 12px; border-color: var(--gm-border); vertical-align: middle; font-size: 12px; }
.table-hover tbody tr:hover { background: #fafbf9; }

.badge { border-radius: 9px; font-weight: 700; padding: .45em .7em; }
.bg-soft-primary { background: var(--gm-primary-soft); color: var(--gm-primary-strong); }
.bg-soft-accent { background: var(--gm-accent-soft); color: var(--gm-accent); }
.text-royal-blue, .text-navy, .text-ocean, .text-ocean-blue { color: var(--gm-primary-strong) !important; }
.bg-gradient-navy, .bg-navy { background: var(--gm-primary) !important; }
.border-ocean { border-color: var(--gm-primary) !important; }

.alert { border: 1px solid; border-radius: 14px; font-size: 13px; }
.alert-success { background: #edf5ef; color: #3e6750; border-color: #d4e5d8; }
.alert-danger { background: #faeeee; color: #8f474c; border-color: #efcfd1; }
.alert-warning { background: #fbf4e9; color: #815d2d; border-color: #ead9bd; }

.section-card { padding: 22px; margin-bottom: 18px; }
.section-title { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 900; margin: 0 0 18px; }
.section-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: var(--gm-primary-soft); color: var(--gm-primary); }
.dynamic-row { border: 1px solid var(--gm-border); border-radius: 14px; padding: 14px; background: #fbfcfa; margin-bottom: 10px; }
.empty-state { padding: 42px 20px; text-align: center; color: var(--gm-muted); }
.stat-value { font-size: 28px; font-weight: 900; color: var(--gm-text); }
.stat-label { font-size: 12px; color: var(--gm-muted); }

.notification-card { border-right: 4px solid var(--gm-info) !important; }
.notification-card.warning { border-right-color: var(--gm-warning) !important; }
.notification-card.danger { border-right-color: var(--gm-danger) !important; }
.notification-card.success { border-right-color: var(--gm-success) !important; }

.pagination { gap: 4px; }
.page-link { border-radius: 9px !important; border-color: var(--gm-border); color: var(--gm-primary); }
.page-item.active .page-link { background: var(--gm-primary); border-color: var(--gm-primary); }

@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(100%); }
    .app-sidebar.open { transform: translateX(0); }
    .sidebar-overlay.show { display: block; }
    .app-main { margin-right: 0; }
    .mobile-toggle { display: grid; }
    .app-header { padding: 0 16px; }
    .app-content { padding: 18px 14px; }
    .user-chip .user-info { display: none; }
    .page-header { align-items: flex-start; flex-direction: column; }
}

/* Global premium compatibility layer for legacy pages */
.tech-background, .bg-decor, .watermark-icon { display: none !important; }
[class*="bg-gradient-"], .btn-navy-3d, .btn-royal-3d, .brand-icon {
    background-image: none !important;
}
.bg-gradient-ocean, .bg-gradient-navy, .btn-navy-3d, .btn-royal-3d { background-color: var(--gm-primary) !important; }
.glass-header, .glass-card, .modern-card, .form-card, .details-card {
    background: var(--gm-surface) !important;
    backdrop-filter: none !important;
    border: 1px solid var(--gm-border) !important;
    box-shadow: var(--gm-shadow) !important;
}
.text-ocean-accent, .text-ocean, .text-royal, .text-primary { color: var(--gm-primary-strong) !important; }
.border-ocean-light, .border-ocean { border-color: var(--gm-border) !important; }
.icon-box-3d, .section-badge-3d, .icon-wrapper {
    box-shadow: none !important;
    background: var(--gm-primary-soft) !important;
    color: var(--gm-primary) !important;
}
.floating-icon { animation: none !important; }
.modal-content { border: 1px solid var(--gm-border); border-radius: var(--gm-radius); box-shadow: var(--gm-shadow); }
.modal-header, .modal-footer { border-color: var(--gm-border); }
.dropdown-menu { border: 1px solid var(--gm-border); border-radius: 14px; box-shadow: var(--gm-shadow); }
.input-group-text { border-color: var(--gm-border); background: var(--gm-surface-muted); color: var(--gm-primary); }

/* Authentication */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--gm-bg); }
.auth-shell { width: min(920px, 100%); display: grid; grid-template-columns: 1.05fr .95fr; background: var(--gm-surface); border: 1px solid var(--gm-border); border-radius: 28px; overflow: hidden; box-shadow: var(--gm-shadow); }
.auth-brand { padding: 52px 46px; background: var(--gm-sidebar); color: #fff; display: flex; flex-direction: column; justify-content: space-between; min-height: 560px; }
.auth-brand-mark { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.12); font-size: 24px; }
.auth-brand h1 { font-size: 30px; font-weight: 900; line-height: 1.35; margin: 24px 0 12px; }
.auth-brand p { color: rgba(255,255,255,.68); line-height: 1.9; font-size: 14px; }
.auth-features { display: grid; gap: 12px; margin-top: 34px; }
.auth-feature { display: flex; align-items: center; gap: 10px; color: rgba(255,255,255,.8); font-size: 12px; }
.auth-feature i { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 10px; background: rgba(255,255,255,.08); }
.auth-form-panel { padding: 58px 48px; display: flex; flex-direction: column; justify-content: center; }
.auth-kicker { color: var(--gm-primary); font-size: 12px; font-weight: 800; margin-bottom: 8px; }
.auth-title { font-size: 26px; font-weight: 900; margin-bottom: 7px; }
.auth-subtitle { color: var(--gm-muted); font-size: 13px; margin-bottom: 30px; }
.auth-input { position: relative; }
.auth-input > i { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); color: var(--gm-muted); z-index: 3; }
.auth-input .form-control { padding-right: 43px; min-height: 50px; }
.auth-footer { color: rgba(255,255,255,.48); font-size: 10px; }
@media (max-width: 767.98px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-brand { min-height: auto; padding: 28px; }
    .auth-brand .auth-features, .auth-brand p { display: none; }
    .auth-brand h1 { font-size: 21px; margin: 16px 0 0; }
    .auth-form-panel { padding: 34px 24px; }
}


/* Final authority: neutralize all remnants of the retired blue/glass identity. */
body { background-color: var(--gm-bg) !important; background-image: none !important; }
.tech-background, .bg-decor, .watermark-icon, [class*="background-pattern"] { display: none !important; }
[class*="bg-gradient-"], [class*="gradient-"] {
    background-image: none !important;
}
.bg-gradient-blue, .bg-gradient-ocean, .bg-gradient-navy, .bg-gradient-warning,
.btn-navy-3d, .btn-royal-3d, .btn-save-royal, .btn-gradient-ocean {
    background: var(--gm-primary) !important;
    border-color: var(--gm-primary) !important;
    color: #fff !important;
}
.glass-input, .glass-input-group, .modern-input {
    background: var(--gm-surface) !important;
    border-color: var(--gm-border) !important;
    color: var(--gm-text) !important;
    box-shadow: none !important;
}
.glass-input-group:focus-within {
    border-color: var(--gm-primary) !important;
    box-shadow: 0 0 0 3px rgba(82,109,100,.10) !important;
}
.shadow-ocean, .shadow-warning, .shadow-blue, .shadow-3d { box-shadow: var(--gm-shadow) !important; }
.hover-float:hover, .btn-navy-3d:hover, .btn-royal-3d:hover { transform: none !important; }
.section-badge-3d {
    position: static !important;
    display: inline-flex !important;
    background: var(--gm-primary-soft) !important;
    color: var(--gm-primary) !important;
    border: 1px solid var(--gm-border) !important;
}
