/* =========================================================
   CraftGrid Color System — final presentation layer
   Palette:
   Navy  #143D54
   Blue  #1769C2
   Green #16845B
   Amber #B77900
   Red   #C73535
   Neutral background #F5F7F7
   ========================================================= */

:root {
    --cg-color-navy: #143D54;
    --cg-color-navy-deep: #102F44;
    --cg-color-navy-light: #1D4D66;
    --cg-color-blue: #1769C2;
    --cg-color-blue-hover: #1458A8;
    --cg-color-green: #16845B;
    --cg-color-amber: #B77900;
    --cg-color-red: #C73535;
    --cg-color-page: #F5F7F7;
    --cg-color-surface: #FFFFFF;
    --cg-color-border: #DCE4E8;
    --cg-color-border-light: #EDF1F3;
    --cg-color-text: #17324D;
    --cg-color-muted: #66788A;
}

/* Base application surfaces */
body.craftgrid-authenticated-shell {
    background: var(--cg-color-page) !important;
    color: var(--cg-color-text);
}

.craftgrid-authenticated-shell .craftgrid-app-shell main {
    background: transparent !important;
}

/* Header: keep the strong navy identity. */
.craftgrid-authenticated-shell .craftgrid-topbar,
.craftgrid-authenticated-shell .navbar {
    background: linear-gradient(135deg, var(--cg-color-navy-deep) 0%, var(--cg-color-navy) 62%, #17415A 100%) !important;
}

/* Search/header controls */
.craftgrid-authenticated-shell .craftgrid-icon-button,
.craftgrid-authenticated-shell .craftgrid-user-button {
    border-color: rgba(255,255,255,.14) !important;
    background: rgba(255,255,255,.075) !important;
}

.craftgrid-authenticated-shell .craftgrid-icon-button:hover,
.craftgrid-authenticated-shell .craftgrid-user-button:hover,
.craftgrid-authenticated-shell .craftgrid-user-button:focus {
    background: rgba(255,255,255,.13) !important;
    border-color: rgba(255,255,255,.21) !important;
}

/* Sidebar */
.craftgrid-authenticated-shell .erp-sidebar {
    background: linear-gradient(180deg, var(--cg-color-navy-deep) 0%, var(--cg-color-navy) 58%, #122F46 100%) !important;
}

/* Primary actions */
.craftgrid-authenticated-shell .btn-primary,
.craftgrid-authenticated-shell .btn-view {
    background-color: var(--cg-color-blue);
    border-color: var(--cg-color-blue);
}

.craftgrid-authenticated-shell .btn-primary:hover,
.craftgrid-authenticated-shell .btn-primary:focus-visible,
.craftgrid-authenticated-shell .btn-view:hover,
.craftgrid-authenticated-shell .btn-view:focus-visible {
    background-color: var(--cg-color-blue-hover);
    border-color: var(--cg-color-blue-hover);
}

/* Common form focus state */
.craftgrid-authenticated-shell .form-control:focus,
.craftgrid-authenticated-shell .form-select:focus,
.craftgrid-authenticated-shell input:focus,
.craftgrid-authenticated-shell select:focus,
.craftgrid-authenticated-shell textarea:focus {
    border-color: rgba(23,105,194,.55);
    box-shadow: 0 0 0 .18rem rgba(23,105,194,.10);
}

/* Semantic Bootstrap colors */
.craftgrid-authenticated-shell .text-success { color: var(--cg-color-green) !important; }
.craftgrid-authenticated-shell .text-danger { color: var(--cg-color-red) !important; }
.craftgrid-authenticated-shell .text-warning { color: var(--cg-color-amber) !important; }
.craftgrid-authenticated-shell .text-primary { color: var(--cg-color-blue) !important; }

.craftgrid-authenticated-shell .bg-success { background-color: var(--cg-color-green) !important; }
.craftgrid-authenticated-shell .bg-danger { background-color: var(--cg-color-red) !important; }
.craftgrid-authenticated-shell .bg-warning { background-color: var(--cg-color-amber) !important; }
.craftgrid-authenticated-shell .bg-primary { background-color: var(--cg-color-blue) !important; }

/* Standard ERP status badges */
.status-submitted { background-color: var(--cg-color-blue); }
.status-approved,
.status-completed { background-color: var(--cg-color-green); }
.status-rejected { background-color: var(--cg-color-red); }
.status-partially-received { background-color: var(--cg-color-amber); }

/* Dashboard: align its local palette with the global CraftGrid system. */
.cg-dashboard {
    --cg-text: #17324D !important;
    --cg-muted: #66788A !important;
    --cg-border: #DCE4E8 !important;
    --cg-surface: #FFFFFF !important;
    --cg-page: #F5F7F7 !important;
    --cg-blue: #1769C2 !important;
    --cg-blue-soft: #EAF3FB !important;
    --cg-green: #16845B !important;
    --cg-green-soft: #EAF6F0 !important;
    --cg-amber: #B77900 !important;
    --cg-amber-soft: #FFF5DF !important;
    --cg-red: #C73535 !important;
    --cg-red-soft: #FFF0EF !important;
}

.cg-dashboard .panel-head,
.cg-dashboard th {
    background: #FBFCFC;
}

.cg-dashboard .panel-head {
    border-bottom-color: var(--cg-color-border-light);
}

/* Slightly lighter navigation backdrop when the overlay menu opens. */
.craftgrid-sidebar-backdrop {
    background: rgba(16,47,68,.10) !important;
}

/* Keep the navigation's existing green identity treatment, but make it
   slightly more restrained and use the same gold only as an indicator. */
.cg-desktop-navigation .sidebar-link.active,
.cg-desktop-navigation .sidebar-group:has(.sidebar-submenu-link.active) > .sidebar-group-toggle {
    background: var(--cg-color-green) !important;
    box-shadow: inset 0 -3px 0 #D8B15A;
}

/* Shared cards should remain neutral rather than blue/green tinted. */
.craftgrid-authenticated-shell .card,
.craftgrid-authenticated-shell .erp-card,
.craftgrid-authenticated-shell .erp-document-card {
    border-color: var(--cg-color-border);
    background: var(--cg-color-surface);
}

/* Avoid overly strong hover shadows across the ERP. */
.craftgrid-authenticated-shell .erp-card:hover {
    box-shadow: 0 4px 14px rgba(23,50,77,.07);
}
