/*
 * Charte du hub — source unique pour toutes les pages.
 *
 * Reprise de la charte de webcreation (studio), déclinée en sombre :
 *   - police : la pile « Avenir Next » du studio (Avenir Next sur Apple,
 *     Segoe UI sous Windows, Roboto sur Android) ;
 *   - fonds : bleu nuit, du plus profond au plus clair ;
 *   - accent : le bleu électrique #1F3CE0 et son violet #5B2BFF ;
 *   - textes : des nuances de blanc ;
 *   - angles : un seul arrondi, 5 px, partout.
 *
 * Toutes les pages — y compris celles migrées du Dashboard — chargent ce
 * fichier : une couleur, une taille ou un espacement se change ici, nulle
 * part ailleurs.
 */

:root {
  color-scheme: dark;

  --font: 'Avenir Next', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Bleu nuit, du fond de page aux surfaces surélevées */
  --bg: #070b19;
  --surface: #0c1328;
  --surface-2: #111a35;
  --surface-3: #172244;

  /* Nuances de blanc */
  --text: #f5f7fc;
  --text-2: #cdd4e6;
  --muted: #97a2bf;
  --dim: #69758f;

  /* Filets teintés de bleu */
  --line: rgba(138, 162, 255, 0.13);
  --line-soft: rgba(138, 162, 255, 0.07);
  --line-strong: rgba(138, 162, 255, 0.26);

  /* Bleu électrique du studio. --accent-deep est la couleur exacte, pour les
     aplats (boutons, pastilles) ; --accent en est la version éclaircie qui
     reste lisible en texte et en trait sur fond nuit. */
  --accent-deep: #1f3ce0;
  --accent-hover: #3453ff;
  --accent: #5a74ff;
  --accent-text: #8aa2ff;
  --accent-soft: rgba(31, 60, 224, 0.22);
  --accent-2: #5b2bff;
  --accent-grad: linear-gradient(135deg, #1f3ce0 0%, #5b2bff 100%);

  /* Données : hausse, baisse, vigilance */
  --up: #10b981;
  --up-soft: rgba(16, 185, 129, 0.14);
  --down: #f25f6e;
  --down-soft: rgba(242, 95, 110, 0.14);
  --warn: #f5a524;
  --warn-soft: rgba(245, 165, 36, 0.14);

  /* Un seul arrondi pour tous les angles, celui des boutons : cartes, champs,
     onglets, étiquettes, barres. Seuls les points ronds restent ronds. */
  --r: 5px;
  --r-sm: var(--r);
  --r-btn: var(--r);
  --r-pill: var(--r);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --transition: 240ms cubic-bezier(0.2, 0.7, 0.2, 1);

  --maxw: 1440px;
  --gutter: clamp(16px, 2.4vw, 40px);
  --gap: clamp(12px, 1.2vw, 18px);
  --nav-h: 60px;

  /* Échelle typographique, identique sur toutes les pages */
  --fs-title: clamp(1.5rem, 2.1vw, 1.9rem);
  --fs-h2: 1.08rem;
  --fs-body: 0.9rem;
  --fs-small: 0.78rem;
  --fs-label: 0.66rem;
}

/* ------------------------------------------------------------------ socle */
/* La place de la barre de défilement est toujours réservée : la navigation et
   les contenus centrés ne bougent pas d'un pixel d'une page à l'autre. */
html { font-size: 17px; scrollbar-gutter: stable; }
body {
  margin: 0;
  font-family: var(--font);
  font-weight: 400;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(1100px 520px at 12% -8%, rgba(31, 60, 224, 0.16), transparent 62%),
    radial-gradient(900px 480px at 100% 0%, rgba(91, 43, 255, 0.08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
::selection { background: rgba(31, 60, 224, 0.45); color: #fff; }

/* ----------------------------------------------------------- navigation */
.hubnav {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(7, 11, 25, 0.82);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
  font-family: var(--font);
}
.hubnav-in {
  max-width: var(--maxw);
  height: var(--nav-h);
  margin: 0 auto;
  padding: 0 var(--gutter);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.hubnav-in::-webkit-scrollbar { display: none; }
.hubnav .mark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-right: 16px;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.hubnav .mark::before {
  content: "";
  width: 11px;
  height: 11px;
  border-radius: var(--r);
  background: var(--accent-grad);
  box-shadow: 0 0 14px rgba(31, 60, 224, 0.6);
}
.hubnav .sep { width: 1px; height: 18px; background: var(--line); margin: 0 6px; flex-shrink: 0; }
.hubnav a.item {
  display: inline-flex;
  align-items: center;
  padding: 7px 9px;
  border-radius: var(--r-pill);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--transition), background var(--transition);
}
.hubnav a.item:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
/* Page courante : un simple trait bleu dessous, sans cadre. */
.hubnav a.item { position: relative; }
.hubnav a.item[aria-current="page"] { color: #fff; background: transparent; }
.hubnav a.item[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 9px;
  right: 9px;
  bottom: -2px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(90, 116, 255, 0.7);
}
.hubnav .spacer { flex: 1; min-width: 12px; }
.hubnav .logout {
  flex-shrink: 0;
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-btn);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--transition), border-color var(--transition);
}
.hubnav .logout:hover { color: #fff; border-color: var(--accent); }

/* ----------------------------------------------------- conteneur de page */
.page { font-family: var(--font); color: var(--text); min-height: 100dvh; }
.page-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px var(--gutter) 48px;
  box-sizing: border-box;
}

/* En-tête de page : étiquette, titre, sous-titre, outils à droite */
.hub-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
/* Titre de page : le nom de la page, en gras, première lettre seule en
   majuscule. Aucune étiquette au-dessus, aucune phrase en dessous. */
.hub-head h1 {
  margin: 0;
  font-size: var(--fs-title);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text);
}
.hub-head .sub { margin: 8px 0 0; max-width: 720px; font-size: var(--fs-body); color: var(--muted); }
.hub-head .tools { display: flex; align-items: center; gap: 10px; }

/* ------------------------------------------------------------ composants */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.eyebrow .pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: hub-pulse 2s infinite;
}
@keyframes hub-pulse {
  0% { box-shadow: 0 0 0 0 rgba(90, 116, 255, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(90, 116, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(90, 116, 255, 0); }
}

.label {
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px 22px;
  min-width: 0;
  box-sizing: border-box;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--r-btn);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.btn-primary { background: var(--accent-deep); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 10px 26px rgba(31, 60, 224, 0.35); }
.btn-ghost { background: transparent; color: var(--text-2); border-color: var(--line-strong); }
.btn-ghost:hover { color: #fff; border-color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; box-shadow: none; }

.input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 13px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 0.84rem;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input::placeholder { color: var(--dim); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31, 60, 224, 0.25); }

.num { font-variant-numeric: tabular-nums; }
.up { color: var(--up); }
.down { color: var(--down); }
.warn { color: var(--warn); }
.dim { color: var(--dim); }

/* -------------------------------------------------------------- squelette */
/* Des blocs aux proportions du contenu attendu, balayés d'un reflet bleu :
   la page a sa forme définitive avant même que les données n'arrivent. */
.skel {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  color: transparent !important;
  user-select: none;
}
.skel::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(90, 116, 255, 0.12), rgba(255, 255, 255, 0.05), transparent);
  animation: hub-shimmer 1.4s ease-in-out infinite;
}
@keyframes hub-shimmer { to { transform: translateX(100%); } }
.skel-line { display: block; height: 0.8em; margin: 0.45em 0; }
.skel-title { display: block; height: 1.5em; width: 45%; margin-bottom: 0.6em; }
.skel-block { display: block; }
.skel-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 22px; }
@media (prefers-reduced-motion: reduce) {
  .skel::after, .eyebrow .pulse { animation: none; }
}

/* Apparition douce du contenu qui remplace le squelette */
.fade-in { animation: hub-fade 0.35s ease both; }
@keyframes hub-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------- mise à jour en cours */
/* Les dernières données restent affichées ; un reflet bleu les parcourt le
   temps que les données à jour arrivent. */
.refreshing :is(.panel, .tile, .ov-state, .macro-in, .cl-item, .board-table) {
  position: relative;
  overflow: hidden;
}
.refreshing :is(.panel, .tile, .ov-state, .macro-in, .cl-item, .board-table)::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(90, 116, 255, 0.10), rgba(255, 255, 255, 0.04), transparent);
  animation: hub-shimmer 1.4s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .refreshing :is(.panel, .tile, .ov-state, .macro-in, .cl-item, .board-table)::after { animation: none; opacity: 0.4; transform: none; }
}
