/* ================================================================
   CraftGrid One — Unified Brand Layer
   Shared product identity and responsive shell colours.
   UI-only: no routing, permission, data, or workflow changes.
   ================================================================ */
:root {
    --cg-brand-primary: #1769AA;
    --cg-brand-primary-hover: #12548C;
    --cg-brand-sky: #38BDF8;
    --cg-brand-soft: #EEF5FC;
    --cg-brand-border: #D8E3EF;
    --cg-brand-navy: #102B40;
    --cg-brand-yellow: #FFC629;
}

/* Authenticated shell follows the same blue identity as the login screen. */
body.craftgrid-authenticated-shell {
    --cg-login-green: var(--cg-brand-primary);
    --cg-login-green-bright: var(--cg-brand-primary-hover);
    --cg-login-green-soft: var(--cg-brand-soft);
    --cg-login-border: var(--cg-brand-border);
    --cg-brand-green: var(--cg-brand-primary);
    background:
        radial-gradient(circle at 92% 8%, rgba(56,189,248,.055), transparent 24%),
        linear-gradient(135deg, #F7FAFE 0%, #F2F6FB 55%, #F8FAFD 100%) !important;
}

/* Product wordmark: CraftGrid in high-contrast white, One in brand blue. */
.craftgrid-authenticated-shell .craftgrid-topbar,
.craftgrid-authenticated-shell .craftgrid-topbar.navbar {
    background: linear-gradient(110deg, #102B40 0%, #123B5E 58%, #15518A 100%) !important;
    border-bottom: 2px solid rgba(56,189,248,.55) !important;
}
.craftgrid-authenticated-shell .cg-brand-copy strong,
.craftgrid-authenticated-shell .cg-brand-copy strong span {
    color: #FFFFFF !important;
}
.craftgrid-authenticated-shell .cg-brand-copy strong em,
.craftgrid-authenticated-shell .craftgrid-mobile-sidebar-brand-name em,
.craftgrid-authenticated-shell .sidebar-brand-name em {
    color: var(--cg-brand-sky) !important;
    font-style: normal;
}
.craftgrid-authenticated-shell .cg-brand-copy small {
    color: rgba(255,255,255,.72) !important;
}

/* One reusable nine-square symbol shared by login, header and mobile drawer. */
.craftgrid-authenticated-shell .cg-brand-grid-mark {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 3px !important;
    width: 39px !important;
    height: 39px !important;
    min-width: 39px;
    padding: 1px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    flex: 0 0 39px;
}
.craftgrid-authenticated-shell .cg-brand-grid-mark > i {
    display: block;
    min-width: 0;
    min-height: 0;
    border-radius: 3px;
    background: var(--cg-brand-yellow) !important;
}
.craftgrid-authenticated-shell .craftgrid-brand-icon.cg-brand-grid-mark {
    overflow: visible;
}

/* Header controls retain contrast and use blue for non-semantic accents. */
.craftgrid-authenticated-shell .craftgrid-avatar {
    background: var(--cg-brand-primary) !important;
}
.craftgrid-authenticated-shell .craftgrid-mobile-menu:focus-visible {
    outline-color: var(--cg-brand-sky) !important;
}
.craftgrid-authenticated-shell .cg-topbar-workspace-context > i {
    color: var(--cg-brand-sky) !important;
}

/* Desktop keeps the approved dark navy sidebar; selected destination is light blue. */
@media (min-width: 992px) {
    .craftgrid-authenticated-shell .erp-sidebar {
        background: linear-gradient(180deg, #102B40 0%, #143650 100%) !important;
    }
    .craftgrid-authenticated-shell .erp-sidebar .sidebar-link.active,
    .craftgrid-authenticated-shell .erp-sidebar .sidebar-submenu-link.active {
        color: #12324D !important;
        background: #DCEEFF !important;
        box-shadow: inset 3px 0 0 var(--cg-brand-primary) !important;
    }
    .craftgrid-authenticated-shell .erp-sidebar .sidebar-link.active > span,
    .craftgrid-authenticated-shell .erp-sidebar .sidebar-link.active > i,
    .craftgrid-authenticated-shell .erp-sidebar .sidebar-link.active .sidebar-link-content > span,
    .craftgrid-authenticated-shell .erp-sidebar .sidebar-link.active .sidebar-link-content > i,
    .craftgrid-authenticated-shell .erp-sidebar .sidebar-submenu-link.active > span,
    .craftgrid-authenticated-shell .erp-sidebar .sidebar-submenu-link.active > i {
        color: #12324D !important;
    }
    .craftgrid-authenticated-shell .erp-sidebar .sidebar-group:has(.sidebar-submenu-link.active) > .sidebar-group-toggle {
        background: rgba(23,105,170,.20) !important;
        box-shadow: inset 3px 0 0 var(--cg-brand-primary) !important;
    }
}

/* Mobile drawer is deliberately light; the app header remains navy. */
@media (max-width: 991.98px) {
    .craftgrid-authenticated-shell .craftgrid-mobile-sidebar {
        background: #FFFFFF !important;
        border-right: 1px solid var(--cg-brand-border) !important;
    }
    .craftgrid-authenticated-shell .craftgrid-mobile-sidebar .offcanvas-header {
        background: linear-gradient(110deg, #102B40 0%, #123B5E 100%) !important;
        border-bottom: 1px solid rgba(56,189,248,.35) !important;
    }
    .craftgrid-authenticated-shell .craftgrid-mobile-sidebar .offcanvas-body,
    .craftgrid-authenticated-shell .craftgrid-mobile-sidebar .erp-sidebar {
        background: #FFFFFF !important;
        color: #17324D !important;
    }
    .craftgrid-authenticated-shell .craftgrid-mobile-sidebar .erp-sidebar .sidebar-section-label,
    .craftgrid-authenticated-shell .craftgrid-mobile-sidebar .erp-sidebar .sidebar-subsection-label {
        color: #71869A !important;
        background: #F5F8FC !important;
        border-color: #DCE7F2 !important;
    }
    .craftgrid-authenticated-shell .craftgrid-mobile-sidebar .erp-sidebar .sidebar-group-toggle,
    .craftgrid-authenticated-shell .craftgrid-mobile-sidebar .erp-sidebar .sidebar-link,
    .craftgrid-authenticated-shell .craftgrid-mobile-sidebar .erp-sidebar .sidebar-submenu-link {
        color: #17324D !important;
        background: transparent !important;
    }
    .craftgrid-authenticated-shell .craftgrid-mobile-sidebar .erp-sidebar .sidebar-group-toggle .sidebar-link-content > i,
    .craftgrid-authenticated-shell .craftgrid-mobile-sidebar .erp-sidebar .sidebar-link > i,
    .craftgrid-authenticated-shell .craftgrid-mobile-sidebar .erp-sidebar .sidebar-submenu-link > i,
    .craftgrid-authenticated-shell .craftgrid-mobile-sidebar .erp-sidebar .sidebar-chevron {
        color: #52718F !important;
    }
    .craftgrid-authenticated-shell .craftgrid-mobile-sidebar .erp-sidebar .sidebar-group-toggle:hover,
    .craftgrid-authenticated-shell .craftgrid-mobile-sidebar .erp-sidebar .sidebar-link:hover,
    .craftgrid-authenticated-shell .craftgrid-mobile-sidebar .erp-sidebar .sidebar-submenu-link:hover:not(.active) {
        color: #12548C !important;
        background: #F2F7FD !important;
    }
    .craftgrid-authenticated-shell .craftgrid-mobile-sidebar .erp-sidebar .sidebar-link.active,
    .craftgrid-authenticated-shell .craftgrid-mobile-sidebar .erp-sidebar .sidebar-submenu-link.active,
    .craftgrid-authenticated-shell .craftgrid-mobile-sidebar .erp-sidebar .sidebar-group:has(.sidebar-submenu-link.active) > .sidebar-group-toggle {
        color: #12548C !important;
        background: #DCEEFF !important;
        box-shadow: inset 3px 0 0 var(--cg-brand-primary) !important;
    }
    .craftgrid-authenticated-shell .craftgrid-mobile-sidebar .erp-sidebar .sidebar-link.active > span,
    .craftgrid-authenticated-shell .craftgrid-mobile-sidebar .erp-sidebar .sidebar-link.active > i,
    .craftgrid-authenticated-shell .craftgrid-mobile-sidebar .erp-sidebar .sidebar-link.active .sidebar-link-content > span,
    .craftgrid-authenticated-shell .craftgrid-mobile-sidebar .erp-sidebar .sidebar-link.active .sidebar-link-content > i,
    .craftgrid-authenticated-shell .craftgrid-mobile-sidebar .erp-sidebar .sidebar-submenu-link.active > span,
    .craftgrid-authenticated-shell .craftgrid-mobile-sidebar .erp-sidebar .sidebar-submenu-link.active > i {
        color: #12548C !important;
    }
    .craftgrid-authenticated-shell .craftgrid-mobile-sidebar .sidebar-brand-name {
        color: #FFFFFF !important;
    }
    .craftgrid-authenticated-shell .craftgrid-mobile-sidebar .sidebar-brand-name em {
        color: var(--cg-brand-sky) !important;
    }
    .craftgrid-authenticated-shell .craftgrid-mobile-sidebar .sidebar-brand-mark.cg-brand-grid-mark {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px;
        flex-basis: 32px;
    }
}

/* Login wordmark uses the same navy/blue pairing as the authenticated shell. */
.cg-login-brand-copy strong,
.cg-login-brand-copy strong span { color: #102B40 !important; }
.cg-login-brand-copy strong em,
.cg-card-brand span { color: #1769AA !important; }
.cg-card-brand sup { display: none !important; }

/* Common dashboard controls and headings use the approved brand blue. */
.craftgrid-authenticated-shell .cg-dashboard-kicker,
.craftgrid-authenticated-shell .cg-dashboard-card-link,
.craftgrid-authenticated-shell .cg-dashboard-area-link:hover {
    color: var(--cg-brand-primary) !important;
}
.craftgrid-authenticated-shell .cg-dashboard-section-heading::before {
    background: var(--cg-brand-primary) !important;
}
.craftgrid-authenticated-shell .btn-primary,
.craftgrid-authenticated-shell .btn-outline-primary:hover,
.craftgrid-authenticated-shell .page-item.active .page-link {
    background-color: var(--cg-brand-primary) !important;
    border-color: var(--cg-brand-primary) !important;
}
.craftgrid-authenticated-shell a:focus-visible,
.craftgrid-authenticated-shell button:focus-visible {
    outline-color: rgba(23,105,170,.65);
}

@media (prefers-reduced-motion: reduce) {
    .craftgrid-authenticated-shell .erp-sidebar *,
    .craftgrid-authenticated-shell .craftgrid-mobile-sidebar * {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
    }
}
