:root {
  /* NOVERA brand palette (navy from the logo wordmark, gold from the logo arrow). Sidebar is
     now a light, Oracle-ERP-style panel rather than a solid dark block; --navy/--navy-light
     stay in place because they're still used for accents, table headers and buttons. */
  --navy: #0A2E5C;
  --navy-light: #123A73;
  --gold: #C9A227;
  --accent: #4A6FA5;
  --cream: #F2EFE6;
  --border: #E1DED2;

  --topbar-h: 52px;
  --sidebar-bg: #F4F7FB;
  --sidebar-border: #DBE3EE;
  --sidebar-text: #0A2E5C;
  --sidebar-hover: #DCE8F7;
  --sidebar-muted: #5B7091;
}

body { background-color: #FAF9F6; font-family: "Segoe UI", Arial, sans-serif; color: #1F2A3C; -webkit-font-smoothing: antialiased; }

/* --- Typographie générale (zone principale) --------------------------------------------
   Titres de page (h3), titres de carte (h5) et texte cohérents partout, sans avoir à
   toucher chaque template : une seule feuille de style porte l'identité visuelle. */
.main-content h1, .main-content h2, .main-content h3 {
  color: var(--navy); font-weight: 700; letter-spacing: -.01em;
}
.main-content h3 { font-size: 1.3rem; }
.main-content h5 { color: var(--navy); font-weight: 600; font-size: .95rem; margin-bottom: .85rem; }
.main-content .text-muted { color: #6B7280 !important; }

/* --- Top bar -------------------------------------------------------------------------
   Slim, full-width bar above the sidebar+content area: logo/app name on the left,
   signed-in user + sign-out on the right (see base.html). Fixed height so the app-shell
   below sizes itself to exactly fill the rest of the viewport. */
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1rem; background: #fff; border-bottom: 2px solid var(--navy);
}
.topbar-brand { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.topbar-logo { height: 32px; width: auto; }
.topbar-title { color: var(--navy); font-weight: 600; font-size: 1.05rem; white-space: nowrap; }
.topbar-user { display: flex; align-items: center; gap: .9rem; color: var(--navy); font-size: .85rem; white-space: nowrap; }
.topbar-user strong { font-weight: 600; }
.topbar-company-badge {
  background: var(--sidebar-hover); color: var(--navy); font-weight: 600;
  padding: 3px 10px; border-radius: 20px; font-size: .78rem;
}
.topbar-logout {
  background: none; border: none; padding: 0; color: var(--navy-light); font-size: .85rem;
  text-decoration: underline; cursor: pointer;
}
.topbar-logout:hover { color: var(--navy); }

.app-shell { display: flex; height: calc(100vh - var(--topbar-h)); }

.sidebar {
  width: 260px; background-color: var(--sidebar-bg); color: var(--sidebar-text); flex-shrink: 0;
  padding: 20px 16px; display: flex; flex-direction: column;
  height: 100%; overflow-y: auto; border-right: 1px solid var(--sidebar-border);
}
.sidebar-brand h2 { font-size: 18px; margin-bottom: 0; color: var(--sidebar-text); }
.sidebar-brand p { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--sidebar-muted); }
.sidebar hr { border-color: var(--sidebar-border); opacity: 1; }
.sidebar-nav { flex-grow: 1; }

/* --- Menu ERP par modules (groupes repliables) -------------------------------------------
   Chip discret pour l'en-tête de chaque module, ligne verticale de connexion façon
   arborescence pour les liens du groupe, et lien actif en "pilule" pleine couleur plutôt
   qu'un simple soulignement — sensation plus moderne et plus lisible en un coup d'œil que
   la version précédente. La section qui contient la page active s'ouvre automatiquement
   (voir le script de base.html) ; les autres restent repliées pour ne pas noyer
   l'utilisateur sous 25 liens d'un coup, comme le fait n'importe quel ERP réel. */
.menu-group + .menu-group { margin-top: .2rem; }
.menu-group-header {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  padding: .5rem .75rem; margin: 0 .1rem; background: transparent; border: none;
  border-radius: 8px; color: var(--sidebar-muted);
  text-transform: uppercase; font-size: .7rem; letter-spacing: .06em; font-weight: 700;
  cursor: pointer; transition: background-color .15s ease, color .15s ease;
}
.menu-group-header:hover { background-color: rgba(10, 46, 92, 0.06); color: var(--navy); }
.menu-group-header[aria-expanded="true"] { color: var(--navy); }
.menu-group-header .chevron { transition: transform .18s ease; font-size: .6rem; opacity: .75; }
.menu-group-header[aria-expanded="true"] .chevron { transform: rotate(90deg); }

.menu-group-items {
  margin-left: 1.15rem; padding-left: .6rem; border-left: 1px solid var(--sidebar-border);
  margin-top: 2px; margin-bottom: 6px;
}
.menu-group-items .nav-link { padding: 8px 12px; font-size: .88rem; }
.menu-single .nav-link { padding: 10px 12px; }

.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: .5rem;
  color: var(--sidebar-text); border-radius: 8px; margin-bottom: 2px; font-weight: 500;
  transition: background-color .15s ease, color .15s ease, transform .12s ease;
}
.sidebar-nav .nav-link:hover { background-color: var(--sidebar-hover); color: var(--navy); transform: translateX(2px); }
.sidebar-nav .nav-link.active {
  background-color: var(--navy); color: #fff; font-weight: 600;
  box-shadow: 0 3px 10px rgba(10, 46, 92, .25);
}
.sidebar-nav .nav-link.active:hover { color: #fff; transform: none; }

.sidebar-nav .nav-link, .menu-group-header { user-select: none; }
.sidebar-footer p { font-size: 13px; color: var(--sidebar-text); margin-bottom: 6px; }
.sidebar-footer .db-note { font-size: 11px; margin-top: 10px; color: var(--sidebar-muted); }

/* Compact "signed in as" card in the sidebar footer, replacing the old plain text lines. */
.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin-bottom: 10px;
  background: #fff; border: 1px solid var(--sidebar-border); border-radius: 10px;
}
.user-avatar {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%;
  background: var(--navy); color: #fff; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center; text-transform: uppercase;
}
.user-card-info { min-width: 0; }
.user-card-name {
  margin: 0; font-size: 13px; font-weight: 600; color: var(--sidebar-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-card-role {
  display: inline-block; margin-top: 2px; font-size: 11px; font-weight: 600;
  color: var(--navy); background: var(--sidebar-hover); padding: 1px 8px; border-radius: 20px;
}

.main-content { flex-grow: 1; min-width: 0; height: 100%; overflow-y: auto; }
.main-content .container-fluid { max-width: 1400px; }

/* --- Cartes ------------------------------------------------------------------------------
   Un seul style de carte (bord fin + ombre légère + coins arrondis) pour tout le logiciel :
   KPI, graphiques, formulaires, listes... au lieu du rendu Bootstrap générique par défaut. */
.main-content .card {
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(10, 46, 92, 0.06);
}
.main-content .card-body { padding: 1.1rem 1.25rem; }

/* --- Boutons -------------------------------------------------------------------------
   Remplace le bleu Bootstrap par défaut par la marque NOVERA partout (formulaires,
   filtres, actions "Go", exports...), avec des coins plus doux. */
.btn { border-radius: 8px; font-weight: 500; }
.btn-sm { border-radius: 6px; }
.btn-primary { background-color: var(--navy); border-color: var(--navy); }
.btn-primary:hover, .btn-primary:focus { background-color: var(--navy-light); border-color: var(--navy-light); }
.btn-outline-primary { color: var(--navy); border-color: var(--navy); }
.btn-outline-primary:hover, .btn-outline-primary:focus { background-color: var(--navy); border-color: var(--navy); color: #fff; }

/* --- Champs de formulaire --------------------------------------------------------------
   Cohérents avec la carte de connexion : coins arrondis, halo bleu marine au focus. */
.form-control, .form-select {
  border-radius: 8px; border-color: var(--border);
}
.form-control:focus, .form-select:focus {
  border-color: var(--navy); box-shadow: 0 0 0 .2rem rgba(10, 46, 92, 0.12);
}
.form-label { font-weight: 600; font-size: .85rem; color: #33415C; }

/* --- Messages flash ---------------------------------------------------------------------
   Coins arrondis, pas de bordure épaisse — les couleurs sémantiques Bootstrap
   (succès/erreur/info) restent inchangées pour ne pas perdre leur sens. */
.alert { border-radius: 10px; border: none; font-size: .9rem; }

/* --- Fenêtres modales ---------------------------------------------------------------- */
.modal-content { border: none; border-radius: 12px; box-shadow: 0 20px 50px rgba(10, 46, 92, .25); }
.modal-header { border-bottom: 1px solid var(--border); }
.modal-header .modal-title { color: var(--navy); font-weight: 700; }

/* --- Ascenseurs discrets (Chrome/Edge) --------------------------------------------------- */
.sidebar::-webkit-scrollbar, .main-content::-webkit-scrollbar, .table-scroll-box::-webkit-scrollbar {
  width: 8px; height: 8px;
}
.sidebar::-webkit-scrollbar-thumb, .main-content::-webkit-scrollbar-thumb, .table-scroll-box::-webkit-scrollbar-thumb {
  background: #C9D2E0; border-radius: 8px;
}
.sidebar::-webkit-scrollbar-thumb:hover, .main-content::-webkit-scrollbar-thumb:hover { background: #A9B7CC; }

.sidebar-logo { width: 64px; height: 64px; border-radius: 12px; background: #fff; padding: 6px; margin-bottom: 8px; object-fit: contain; }
.login-logo { width: 72px; height: 72px; border-radius: 14px; object-fit: contain; }

.login-wrap {
  min-height: calc(100vh - var(--topbar-h));
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-light) 45%, var(--navy) 100%);
  padding: 24px;
}
.login-card {
  width: 380px; border: none; border-top: 4px solid var(--gold); border-radius: 14px;
  padding: 32px 30px; background: #fff; box-shadow: 0 12px 32px rgba(10,46,92,0.28);
}
.login-logo { width: 72px; height: 72px; border-radius: 14px; object-fit: contain; display: block; margin: 0 auto; }
.login-title { font-size: 19px; font-weight: 700; color: var(--navy); }
.login-subtitle { font-size: 13px; color: var(--sidebar-muted); }
.login-card .form-label { font-size: 13px; font-weight: 600; color: var(--sidebar-text); }
.login-card .form-control { padding: 9px 12px; border-radius: 8px; border-color: var(--border); }
.login-card .form-control:focus {
  border-color: var(--navy); box-shadow: 0 0 0 .2rem rgba(10,46,92,0.15);
}
.login-card .btn-primary {
  padding: 10px 0; font-weight: 600; letter-spacing: .02em;
}
.login-lang .btn { border-radius: 20px; font-size: 12px; }

.kpi-card {
  position: relative; overflow: hidden;
  background-color: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px;
  transition: box-shadow .15s ease, transform .15s ease;
}
.kpi-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--navy) 0%, var(--gold) 100%);
}
.kpi-card:hover { box-shadow: 0 4px 14px rgba(10, 46, 92, 0.10); transform: translateY(-1px); }
.kpi-card .kpi-label { font-size: 11.5px; text-transform: uppercase; color: var(--sidebar-muted); letter-spacing: .05em; font-weight: 600; }
.kpi-card .kpi-value { font-size: 26px; font-weight: 700; color: var(--navy); line-height: 1.25; margin-top: 2px; }
.kpi-card .kpi-sub { font-size: 12px; color: #8A8A8A; margin-top: 2px; }

.status-pill {
  padding: 4px 12px; border-radius: 20px; font-size: 11.5px; font-weight: 700;
  letter-spacing: .02em; color: white; display: inline-block;
}
.ref-box {
  font-family: 'Courier New', monospace; font-weight: 600; font-size: 13px;
  background-color: var(--cream); border: 1px dashed var(--navy); padding: 4px 10px;
  border-radius: 5px; color: var(--navy-light); display: inline-block;
}
.closed-banner {
  background-color: #FBEAEA; border: 1px solid #C0392B; color: #C0392B;
  padding: 8px 14px; border-radius: 6px; font-weight: 700; text-align:center; margin-bottom: 10px;
}
.grey-note { color: #8A8A8A; font-size: 13px; font-style: italic; }
.line-total { font-weight: 700; color: var(--navy); background-color: var(--cream); padding: 6px 10px; border-radius: 6px; display: inline-block; }

table.data-table th { background-color: var(--navy); color: #fff; font-size: 13px; }
table.data-table th, table.data-table td { padding: .6rem .75rem; }
table.data-table td { font-size: 13px; vertical-align: middle; }
table.data-table tbody tr:hover { background-color: var(--sidebar-hover); }
.clickable-cell { cursor: pointer; }

.item-line-row { border-bottom: 1px solid var(--border); padding-bottom: 10px; margin-bottom: 10px; }

.chart-frozen { max-width: 100%; }
