.topbar .brand {
  grid-template-columns: auto minmax(190px, 1fr) minmax(330px, auto) auto 116px;
}

.brand-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.header-user {
  box-sizing: border-box;
  min-width: 330px;
  min-height: 62px;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.35rem 0.35rem 0.35rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  box-shadow: 0 8px 22px rgb(0 0 0 / 0.06);
}

.header-user > span {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  line-height: 1.2;
}

.header-user > span strong {
  overflow: hidden;
  color: var(--foreground);
  font-size: 0.84rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-user > span small {
  display: block;
  margin: 2px 0 0;
  color: var(--muted-foreground);
  font-size: 0.68rem;
  line-height: 1.2;
}

.header-user .account-link {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: calc(var(--radius-md) - 2px);
  padding: 0 0.7rem;
  background: transparent;
  color: var(--brand-cyan);
  font-size: 0.76rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.header-user .account-link:hover,
.header-user .account-link:focus-visible {
  background: var(--accent);
  color: var(--accent-foreground);
  text-decoration: none;
}

.header-user .header-logout button {
  min-height: 36px;
  border: 0;
  background: var(--muted);
  font-size: 0.76rem;
}

.topbar .freshness {
  width: 230px;
  max-width: 100%;
  min-width: 0;
  height: auto;
  min-height: 62px;
  padding: 10px 14px;
  align-items: center;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.topbar .freshness .status-dot {
  top: 0;
  margin-left: 0;
}

.header-toggle {
  width: 116px;
  min-width: 116px;
  height: 62px;
  min-height: 62px;
  border-radius: var(--radius-md);
}

.topbar-actions .header-shortcuts {
  min-height: 60px;
  align-items: flex-end;
}

.topbar-actions .help-link {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  color: var(--foreground);
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1;
}

.topbar-actions .help-link:hover,
.topbar-actions .help-link:focus-visible {
  border-color: var(--brand-cyan);
  background: var(--muted);
}

.topbar-actions .help-link:focus-visible {
  outline: 2px solid var(--brand-cyan);
  outline-offset: 2px;
}

.header-toggle strong,
.topbar.is-collapsed .header-toggle strong {
  width: 60px;
  color: var(--foreground);
  font-size: 12px !important;
  font-weight: 700;
  line-height: 1;
  text-align: left;
}

.topbar.is-collapsed .brand {
  grid-template-columns: auto minmax(150px, 1fr) minmax(330px, auto) auto 116px;
}

.topbar.is-collapsed .brand-copy > strong {
  font-size: 17px;
}

.topbar.is-collapsed .header-user {
  display: flex;
}

.topbar.is-collapsed .header-user > span strong {
  font-size: 0.84rem;
}

.topbar.is-collapsed .header-user > span small {
  display: block;
}

@media (max-width: 1320px) {
  .topbar .brand-marks {
    min-width: 210px;
  }

  .topbar .rouch-mark {
    width: 148px;
  }

  .header-user {
    min-width: 300px;
  }

  .topbar .brand,
  .topbar.is-collapsed .brand {
    grid-template-columns: auto minmax(170px, 1fr) minmax(300px, auto) auto 116px;
    gap: var(--space-3);
  }
}

@media (max-width: 1480px) {
  .topbar .brand,
  .topbar.is-collapsed .brand {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .topbar .brand-marks {
    grid-column: 1;
    grid-row: 1;
  }

  .brand-copy {
    grid-column: 2 / 4;
    grid-row: 1;
  }

  .header-user {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
  }

  .topbar .freshness {
    grid-column: 2;
    grid-row: 2;
  }

  .header-toggle {
    grid-column: 3;
    grid-row: 2;
  }
}

@media (max-width: 720px) {
  .topbar .brand,
  .topbar.is-collapsed .brand {
    grid-template-columns: minmax(0, 1fr) 116px;
  }

  .topbar .brand-marks,
  .topbar.is-collapsed .brand-marks {
    grid-column: 1 / 3;
    grid-row: 1;
  }

  .brand-copy {
    grid-column: 1 / 3;
    grid-row: 2;
  }

  .header-user,
  .topbar.is-collapsed .header-user {
    width: 100%;
    min-width: 0;
    grid-column: 1 / 3;
    grid-row: 3;
    justify-self: stretch;
  }

  .topbar .freshness,
  .topbar.is-collapsed .freshness {
    grid-column: 1;
    grid-row: 4;
    justify-self: stretch;
  }

  .header-toggle,
  .topbar.is-collapsed .header-toggle {
    grid-column: 2;
    grid-row: 4;
  }

  .topbar.is-collapsed .brand-copy {
    display: none;
  }

  .topbar.is-collapsed .header-user {
    grid-row: 2;
  }

  .topbar.is-collapsed .freshness,
  .topbar.is-collapsed .header-toggle {
    grid-row: 3;
  }
}

@media (max-width: 560px) {
  .header-user {
    justify-content: flex-end;
    padding-left: 0.75rem;
  }
}

/* Jeton sémantique NSES 0.67 pour les liens textuels. */
:root,
[data-theme="gray"],
[data-theme="dark"] {
  --link: #81D3E4;
}

[data-theme="light"] {
  --link: #08745E;
}

.advisor-reason a,
footer a {
  color: var(--link);
  font-weight: 700;
  text-decoration: underline solid;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.advisor-reason a:hover,
footer a:hover {
  color: var(--link);
  text-decoration-thickness: 2px;
}

/* Alignement optique commun des deux marques partenaires. */
.topbar .brand-marks {
  min-width: 402px;
  gap: 14px;
}

.topbar .nsk-portal-link {
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
}

.topbar .nsk-portal-link:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 3px;
}

.topbar .nsk-mark,
.topbar .rouch-mark {
  flex: 0 0 auto;
  object-fit: contain;
}

.topbar .nsk-mark {
  width: 58px;
  height: 58px;
}

.topbar .rouch-mark {
  width: auto;
  height: 68px;
}

.topbar.is-collapsed .nsk-mark {
  height: 46px;
  width: 46px;
}

.topbar.is-collapsed .rouch-mark {
  width: auto;
  height: 54px;
}

.quality-note {
  margin: 14px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--muted-foreground);
  font-size: 12px;
  line-height: 1.5;
}

.quality-note strong {
  color: var(--foreground);
}

.legend button {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 92px;
  min-height: 72px;
  text-align: center;
}

.legend button::before {
  display: block;
  flex: 0 0 3px;
  margin-right: 0;
}

.chart-progress {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-content: center;
  grid-template-columns: minmax(220px, 360px);
  gap: 10px;
  text-align: center;
  background: var(--card);
}

.chart-progress strong {
  color: var(--foreground);
  font-size: 28px;
}

.chart-progress span {
  color: var(--muted-foreground);
  font-size: 13px;
}

.chart-progress progress {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--muted);
  color: var(--primary);
}

.chart-progress progress::-webkit-progress-bar {
  background: var(--muted);
  border-radius: 999px;
}

.chart-progress progress::-webkit-progress-value,
.chart-progress progress::-moz-progress-bar {
  background: var(--primary);
  border-radius: 999px;
}

@media (max-width: 1320px) {
  .topbar:not(.is-collapsed) .brand-marks {
    min-width: 350px;
  }

  .topbar:not(.is-collapsed) .nsk-mark {
    height: 50px;
    width: 50px;
  }

  .topbar:not(.is-collapsed) .rouch-mark {
    height: 59px;
  }
}

@media (max-width: 720px) {
  .topbar:not(.is-collapsed) .brand-marks,
  .topbar.is-collapsed .brand-marks {
    min-width: 0;
    gap: 10px;
  }

  .topbar:not(.is-collapsed) .nsk-mark,
  .topbar.is-collapsed .nsk-mark {
    height: 40px;
    width: 40px;
  }

  .topbar:not(.is-collapsed) .rouch-mark,
  .topbar.is-collapsed .rouch-mark {
    height: 47px;
  }
}

@media (max-width: 420px) {
  .topbar:not(.is-collapsed) .nsk-mark,
  .topbar.is-collapsed .nsk-mark {
    height: 34px;
    width: 34px;
  }

  .topbar:not(.is-collapsed) .rouch-mark,
  .topbar.is-collapsed .rouch-mark {
    height: 40px;
  }
}

.acquisition-status {
  display: grid;
  gap: 8px;
  width: 100%;
  min-width: 0;
}
.acquisition-progress {
  display: block;
  appearance: none;
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: linear-gradient(90deg, transparent 0%, var(--brand-cyan) 50%, transparent 100%) -100% 0 / 50% 100% no-repeat var(--muted);
  animation: acquisition-sweep 1.4s ease-in-out infinite;
}
.acquisition-progress::-webkit-progress-bar { background: transparent; }
.acquisition-progress::-moz-progress-bar { background: transparent; }
@keyframes acquisition-sweep { to { background-position: 200% 0; } }
@media (prefers-reduced-motion: reduce) {
  .acquisition-progress { animation: none; background-position: 50% 0; }
}

.advisor-grid .advisor-recommendation { background: #142b36; border: 2px solid #81d3e4; }
.advisor-grid .advisor-recommendation #advice-threshold { color: #ffffff; font-size: 40px; font-weight: 800; }
.advisor-grid .advisor-recommendation span, .advisor-grid .advisor-recommendation small { color: #e6f3f6; }
.advisor-control { align-items: flex-end; }
.advisor-control .control-copy { align-self: center; }
.advisor-control .control-field select, .advisor-control #advice-apply { min-height: 44px; margin-bottom: 0; }

#advisor-title.info-label { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
