/* ============================================================================
   MEEWAV · LE QG — couche visuelle finale

   Ce fichier est volontairement autonome et doit être chargé après styles.css.
   Il affine les vues existantes sans changer leur DOM ni leurs contrats.
   ========================================================================== */

:root {
  --sidebar-w: 216px;
  --qg-bg: #09090d;
  --qg-surface: rgba(18, 17, 24, .72);
  --qg-surface-strong: rgba(24, 22, 32, .9);
  --qg-surface-soft: rgba(255, 255, 255, .025);
  --qg-line: rgba(225, 218, 255, .09);
  --qg-line-strong: rgba(190, 174, 255, .2);
  --qg-violet: #8b6cff;
  --qg-violet-bright: #b9a8ff;
  --qg-violet-soft: rgba(139, 108, 255, .11);
  --qg-text: #f4f2f8;
  --qg-muted: #aaa6b6;
  --qg-faint: #74717f;
  --qg-radius: 17px;
  --qg-radius-small: 11px;
  --qg-feed: none;
  --qg-content: none;
  --qg-wide: none;
}

html {
  scroll-behavior: smooth;
}

body {
  color: var(--qg-text);
  background:
    radial-gradient(900px 420px at 64% -10%, rgba(139, 108, 255, .095), transparent 67%),
    radial-gradient(740px 480px at 12% 108%, rgba(92, 61, 184, .04), transparent 72%),
    var(--qg-bg);
}

body::after {
  opacity: .014;
}

.shell {
  min-height: 100dvh;
}

.shell-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.main {
  width: 100%;
  max-width: none;
  padding: 30px clamp(28px, 3.2vw, 52px) 64px;
}

.view {
  width: 100%;
  max-width: none;
  margin-inline: auto;
  animation: refined-fade .2s ease both;
}

body[data-route="dashboard"] .view {
  max-width: none;
}

body[data-route="journal"] .view,
body[data-route="agents"] .view,
body[data-route="settings"] .view {
  max-width: var(--qg-feed);
}

body[data-route="platforms"] .view,
body[data-route="diffs"] .view {
  max-width: var(--qg-content);
}

body[data-route="media"] .view,
body[data-route="infrastructure"] .view,
body[data-route="services"] .view,
body[data-route="servers"] .view,
body[data-route="archi"] .view {
  max-width: var(--qg-wide);
}

@keyframes refined-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* --------------------------------------------------------------------------
   Coque et navigation
   -------------------------------------------------------------------------- */

.sidebar {
  width: var(--sidebar-w);
  padding: 18px 11px 14px;
  gap: 2px;
  overflow-x: hidden;
  overflow-y: auto;
  border-right: 1px solid var(--qg-line);
  background:
    linear-gradient(180deg, rgba(15, 14, 20, .96), rgba(10, 10, 14, .92)),
    var(--qg-bg);
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
}

.brand {
  min-height: 48px;
  gap: 10px;
  margin: 0 3px 12px;
  padding: 0 8px 13px;
  border-bottom-color: var(--qg-line);
}

.brand-mono {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, .22), transparent 35%),
    linear-gradient(145deg, #8667fa, #5838ce 78%);
  box-shadow: inset 0 1px rgba(255, 255, 255, .2), 0 10px 24px -15px rgba(139, 108, 255, .8);
}

.brand-name {
  color: #f7f5fb;
  font-size: 11.5px;
  letter-spacing: .14em;
}

.brand-sub {
  margin-top: 1px;
  color: var(--qg-faint);
  font-size: 9.5px;
}

.nav-sep {
  margin: 16px 10px 5px;
  color: rgba(170, 166, 182, .56);
  font-size: 8.5px;
  letter-spacing: .14em;
}

.nav-item {
  min-height: 38px;
  height: 38px;
  padding: 0 11px;
  gap: 10px;
  position: relative;
  border: 0;
  border-radius: 11px;
  color: #96929f;
  font-size: 12.5px;
  font-weight: 620;
  transition: color .16s ease, background-color .16s ease;
}

.nav-item::before {
  content: '';
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 0;
  width: 2px;
  border-radius: 999px;
  background: var(--qg-violet-bright);
  opacity: 0;
}

.nav-item:hover {
  color: var(--qg-text);
  background: rgba(255, 255, 255, .035);
  transform: none;
}

.nav-item.active {
  color: #fff;
  border: 0;
  background: linear-gradient(90deg, rgba(139, 108, 255, .17), rgba(139, 108, 255, .07));
}

.nav-item.active::before {
  opacity: 1;
}

.nav-item.active svg {
  color: var(--qg-violet-bright);
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 10px;
  border-top-color: var(--qg-line);
}

.user-chip {
  width: 100%;
  min-height: 44px;
  padding: 7px 10px;
  color: inherit;
  border: 0;
  background: transparent;
  text-align: left;
}

.user-chip:hover {
  background: rgba(139, 108, 255, .055);
}

.user-chip.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(139, 108, 255, .17), rgba(139, 108, 255, .07));
}

.user-chip-name {
  font-size: 11.5px;
}

.user-chip-role {
  font-size: 9.5px;
}

.user-chip-mobile-label {
  display: none;
}

/* --------------------------------------------------------------------------
   Rythme commun, boutons et surfaces
   -------------------------------------------------------------------------- */

.page-head {
  min-height: 58px;
  margin-bottom: 20px;
  align-items: center;
  gap: 18px;
}

.page-head h1 {
  margin-top: 0;
  color: var(--qg-text);
  font-size: clamp(25px, 2.15vw, 31px);
  line-height: 1.08;
  letter-spacing: -.035em;
}

.page-head h1 em {
  color: var(--qg-violet-bright);
}

.page-intro {
  max-width: 680px;
  margin-top: 5px;
  color: var(--qg-muted);
  font-size: 11.5px;
  line-height: 1.5;
}

.eyebrow,
.section-kicker {
  color: var(--qg-faint);
  letter-spacing: .13em;
}

.card {
  box-shadow: none;
}

.btn,
.icon-btn,
.pill,
.nav-item,
.version-tab,
.settings-tab,
.infra-tab,
.diff-aspect-tab,
.diff-section-tab,
.media-album,
.gallery-item,
.infra-row,
.today-row,
.journal-entry,
.agent-entry {
  transform: none !important;
}

.btn {
  height: 36px;
  padding-inline: 16px;
  border-color: var(--qg-line-strong);
  background: rgba(255, 255, 255, .035);
  font-size: 12px;
  box-shadow: none;
  transition: color .16s ease, border-color .16s ease, background-color .16s ease, box-shadow .16s ease;
}

.btn:hover {
  border-color: rgba(190, 174, 255, .3);
  background: rgba(255, 255, 255, .055);
  box-shadow: none;
}

.btn-sm {
  height: 31px;
  padding-inline: 12px;
  font-size: 10.5px;
}

.btn-gold {
  color: #fff;
  border-color: rgba(166, 139, 255, .48);
  background: linear-gradient(180deg, rgba(139, 108, 255, .27), rgba(111, 79, 220, .2));
  box-shadow: inset 0 1px rgba(255, 255, 255, .07), 0 12px 28px -22px rgba(139, 108, 255, .75);
}

.btn-gold:hover {
  border-color: rgba(185, 168, 255, .7);
  background: linear-gradient(180deg, rgba(139, 108, 255, .34), rgba(111, 79, 220, .25));
}

.icon-btn {
  color: var(--qg-muted);
  background: transparent;
  transition: color .16s ease, background-color .16s ease, border-color .16s ease;
}

.icon-btn:hover {
  color: #fff;
  border-color: var(--qg-line-strong);
  background: rgba(139, 108, 255, .075);
}

.input,
.select,
.textarea {
  border-color: var(--qg-line);
  background-color: rgba(255, 255, 255, .03);
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: rgba(190, 174, 255, .17);
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: rgba(166, 139, 255, .5);
  box-shadow: 0 0 0 3px rgba(139, 108, 255, .09);
}

.toolbar {
  gap: 7px;
}

.filter-pills {
  height: 34px;
  flex-wrap: nowrap;
  padding: 3px;
  border-color: var(--qg-line);
  background: rgba(255, 255, 255, .022);
}

.pill {
  height: 26px;
  padding-inline: 12px;
  color: var(--qg-muted);
  font-size: 10.5px;
  transition: color .16s ease, background-color .16s ease, border-color .16s ease;
}

.pill.active {
  color: #fff;
  border-color: rgba(166, 139, 255, .28);
  background: rgba(139, 108, 255, .16);
}

.search-box .input {
  height: 32px;
  border-radius: 999px;
  background-color: rgba(255, 255, 255, .025);
}

.filter-menu > div {
  border-color: var(--qg-line-strong);
  background: rgba(22, 20, 29, .98);
  box-shadow: 0 22px 60px -34px #000;
}

.empty {
  min-height: 160px;
  justify-content: center;
  padding: 32px 24px;
  border: 0;
  border-top: 1px solid var(--qg-line);
  border-bottom: 1px solid var(--qg-line);
  border-radius: 0;
  background: transparent;
}

.empty-title {
  font-size: 15px;
}

.empty-text {
  font-size: 11.5px;
}

/* --------------------------------------------------------------------------
   Aujourd'hui — une page d'accueil, pas un tableau de bord
   -------------------------------------------------------------------------- */

.today-head {
  min-height: 76px;
  margin-bottom: 28px;
}

.today-head h1 {
  font-size: clamp(31px, 3.6vw, 42px);
  letter-spacing: -.047em;
}

.today-head .page-intro {
  font-size: 12.5px;
}

.today-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 38px;
}

.today-section {
  min-width: 0;
}

.today-section-head {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 6px;
}

.today-section-head h2 {
  font-size: 17px;
  letter-spacing: -.025em;
}

.today-section-head > a {
  color: var(--qg-muted);
  font-size: 10.5px;
  font-weight: 700;
}

.today-counts {
  display: flex;
  align-items: center;
  gap: 7px;
}

.today-count {
  min-height: 27px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  color: var(--qg-muted);
  border: 1px solid var(--qg-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .018);
  font-size: 9.5px;
  text-decoration: none;
}

.today-count:hover {
  color: #fff;
  border-color: rgba(166, 139, 255, .24);
  background: rgba(139, 108, 255, .06);
  text-decoration: none;
}

.today-count b {
  color: var(--qg-violet-bright);
  font-size: 11px;
}

.today-feed {
  border-top: 1px solid var(--qg-line);
}

.today-row {
  width: 100%;
  min-height: 68px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 12px;
  padding: 9px 2px;
  color: var(--qg-text);
  border-bottom: 1px solid var(--qg-line);
  background: transparent;
  text-decoration: none;
  transition: color .16s ease, background-color .16s ease;
}

.today-row:hover {
  color: #fff;
  background: linear-gradient(90deg, rgba(139, 108, 255, .052), transparent 72%);
  text-decoration: none;
}

.today-row.is-passive {
  grid-template-columns: 34px minmax(0, 1fr);
}

.today-row-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--qg-violet-bright);
  border-radius: 50%;
  background: rgba(139, 108, 255, .09);
}

.today-row-copy {
  min-width: 0;
}

.today-row-copy b,
.today-row-copy small {
  display: block;
}

.today-row-copy b {
  overflow: hidden;
  color: var(--qg-text);
  font-size: 12.5px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.today-row-copy small {
  margin-top: 2px;
  color: var(--qg-faint);
  font-size: 9.5px;
}

.today-row-arrow {
  color: var(--qg-faint);
  font-size: 20px;
}

.today-calm {
  min-height: 102px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 16px 2px;
  border-top: 1px solid var(--qg-line);
  border-bottom: 1px solid var(--qg-line);
}

.today-calm > span {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: var(--qg-violet-bright);
  border-radius: 50%;
  background: var(--qg-violet-soft);
}

.today-calm b {
  font-size: 13px;
}

.today-calm p,
.today-empty {
  margin-top: 2px;
  color: var(--qg-faint);
  font-size: 10.5px;
}

/* --------------------------------------------------------------------------
   Journal — fil éditorial continu
   -------------------------------------------------------------------------- */

.journal-page-head,
.agents-page-head {
  margin-bottom: 14px;
}

.journal-toolbar-simple,
.agent-toolbar-simple {
  min-height: 48px;
  margin-bottom: 18px;
  padding: 7px 0;
  position: sticky;
  top: 0;
  z-index: 14;
  align-items: center;
  border-bottom: 1px solid var(--qg-line);
  background: linear-gradient(180deg, rgba(9, 9, 13, .97), rgba(9, 9, 13, .9));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.journal-toolbar-simple .search-box .input,
.agent-toolbar-simple .search-box .input {
  width: 180px;
}

.journal-surface,
.agent-surface {
  min-width: 0;
}

.journal-group + .journal-group {
  margin-top: 34px;
}

.journal-group-title {
  margin: 0 0 8px 2px;
  color: var(--qg-faint);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.journal-stream,
.agent-ledger {
  display: block;
  padding: 0;
  border: 0;
  border-top: 1px solid var(--qg-line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.journal-entry,
.agent-entry {
  width: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 16px;
  align-items: start;
  gap: 12px;
  padding: 18px 2px;
  color: var(--qg-text);
  border: 0;
  border-bottom: 1px solid var(--qg-line);
  border-radius: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  transition: background-color .16s ease, opacity .16s ease;
}

.journal-entry:hover,
.journal-entry:focus-visible,
.agent-entry:hover,
.agent-entry:focus-visible {
  padding-left: 2px;
  border-color: var(--qg-line);
  background: linear-gradient(90deg, rgba(139, 108, 255, .052), transparent 74%);
  box-shadow: none;
}

.journal-entry:focus-visible,
.agent-entry:focus-visible {
  box-shadow: inset 2px 0 var(--qg-violet-bright);
}

.journal-entry.is-closed {
  opacity: .55;
}

/* Le journal est une mémoire à feuilleter, pas une table coupée par des traits. */
.journal-stream {
  display: grid;
  gap: 10px;
  border: 0;
}

.journal-entry {
  padding: 16px 16px 16px 14px;
  border: 1px solid rgba(185, 168, 255, .11);
  border-radius: 18px;
  background:
    radial-gradient(circle at 28px 24px, rgba(139, 108, 255, .09), transparent 100px),
    linear-gradient(145deg, rgba(25, 22, 34, .72), rgba(14, 13, 20, .78));
  box-shadow: inset 0 1px rgba(255, 255, 255, .018);
}

.journal-entry:hover,
.journal-entry:focus-visible {
  padding-left: 14px;
  border-color: rgba(166, 139, 255, .28);
  background:
    radial-gradient(circle at 28px 24px, rgba(139, 108, 255, .14), transparent 112px),
    linear-gradient(145deg, rgba(28, 24, 40, .82), rgba(15, 14, 22, .84));
  box-shadow: inset 0 1px rgba(255, 255, 255, .028), 0 0 0 1px rgba(139, 108, 255, .025);
}

.journal-entry:focus-visible {
  outline: 2px solid rgba(166, 139, 255, .45);
  outline-offset: 2px;
}

.journal-entry.is-pinned {
  border-color: rgba(166, 139, 255, .22);
}

.journal-entry-icon,
.agent-entry-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--qg-violet-bright);
  border: 1px solid rgba(166, 139, 255, .18);
  border-radius: 50%;
  background: rgba(139, 108, 255, .075);
  box-shadow: none;
}

.journal-entry-main,
.agent-entry-body {
  min-width: 0;
}

.journal-byline,
.agent-byline {
  min-height: 17px;
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--qg-faint);
  font-size: 9.5px;
}

.journal-byline > span:first-child,
.agent-byline b {
  color: var(--qg-muted);
  font-weight: 700;
}

.journal-pinned {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 3px;
  color: var(--qg-violet-bright);
  font-size: 8.5px;
}

.journal-pinned i {
  display: inline-flex;
}

.journal-entry h2,
.agent-entry h3 {
  margin-top: 5px;
  color: var(--qg-text);
  font-size: 14.5px;
  line-height: 1.38;
  letter-spacing: -.012em;
}

.journal-entry-main > p {
  max-width: 700px;
  margin-top: 4px;
  overflow: hidden;
  color: var(--qg-muted);
  font-size: 11.5px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.journal-meta-line,
.agent-entry-meta {
  margin-top: 7px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--qg-faint);
  font-size: 9px;
  line-height: 1.4;
}

.journal-important {
  min-height: 19px;
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  color: #e8d583;
  border: 1px solid rgba(247, 201, 72, .18);
  border-radius: 999px;
  background: rgba(247, 201, 72, .055);
  font-size: 8px;
  font-weight: 700;
}

.journal-chevron,
.agent-entry-chevron {
  align-self: center;
  color: var(--qg-faint);
  font-size: 21px;
}

body[data-route="journal"] .chip:not(.red):not(.yellow):not(.green),
body[data-route="journal"] .feature-tag,
body[data-route="journal"] .resolved-tag {
  color: var(--qg-muted);
  border-color: var(--qg-line);
  background: rgba(255, 255, 255, .025);
}

body[data-route="journal"] .chip:not(.red):not(.yellow):not(.green) i {
  color: var(--qg-violet-bright);
  background: currentColor !important;
  box-shadow: none !important;
}

.agent-entry.observation .agent-entry-avatar {
  color: var(--qg-violet-bright);
  border-color: rgba(166, 139, 255, .25);
  background: transparent;
}

.agent-entry.intervention .agent-entry-avatar {
  color: #f5f1ff;
  border-color: rgba(166, 139, 255, .35);
  background: rgba(139, 108, 255, .2);
}

.activity-detail > section {
  padding: 17px 0;
  border-top: 1px solid var(--qg-line);
}

.activity-detail > section h3 {
  margin-bottom: 6px;
  color: var(--qg-faint);
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.activity-detail > section p,
.activity-detail > section .md {
  color: var(--qg-muted);
  font-size: 11.5px;
  line-height: 1.65;
}

.activity-proof {
  overflow-wrap: anywhere;
}

/* Les commandes restent un mode d'emploi, pas une console. */
.agents-primary-tabs {
  flex: 0 0 auto;
}

.agent-panel[hidden] {
  display: none !important;
}

.agent-command-guide {
  min-width: 0;
}

.agent-command-guide-head {
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 2px;
  border-bottom: 1px solid var(--qg-line);
}

.agent-command-guide-head > span {
  width: 36px;
  height: 36px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: var(--qg-violet-bright);
  border: 1px solid rgba(166, 139, 255, .18);
  border-radius: 50%;
  background: rgba(139, 108, 255, .075);
}

.agent-command-guide-head h2 {
  color: var(--qg-text);
  font-size: 16px;
  letter-spacing: -.02em;
}

.agent-command-guide-head p {
  margin-top: 3px;
  color: var(--qg-muted);
  font-size: 10.5px;
}

.agent-command-toolbar {
  min-height: 66px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding-block: 12px;
  border-bottom: 1px solid var(--qg-line);
}

.agent-command-toolbar .spacer {
  flex: 1 1 auto;
}

.agent-command-tabs {
  flex: 0 0 auto;
}

.agent-command-search {
  width: min(280px, 28vw);
}

.agent-command-search .input {
  width: 100%;
}

.agent-command-count {
  min-width: 58px;
  color: var(--qg-faint);
  font-size: 9.5px;
  text-align: right;
  white-space: nowrap;
}

.agent-command-groups {
  min-width: 0;
}

.agent-command-group {
  display: grid;
  grid-template-columns: minmax(150px, 18%) minmax(0, 1fr);
  gap: clamp(22px, 4vw, 58px);
  border-bottom: 1px solid var(--qg-line);
}

.agent-command-group > header {
  padding: 24px 2px;
}

.agent-command-group > header h3 {
  color: var(--qg-text);
  font-size: 14px;
  letter-spacing: -.015em;
}

.agent-command-group > header p {
  max-width: 180px;
  margin-top: 5px;
  color: var(--qg-faint);
  font-size: 9.5px;
  line-height: 1.5;
}

.agent-command-list {
  min-width: 0;
}

.agent-command-row {
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(230px, 35%) minmax(0, 1fr);
  align-items: center;
  gap: clamp(18px, 3vw, 44px);
  padding: 10px 2px;
  border-bottom: 1px solid var(--qg-line);
}

.agent-command-row:last-child {
  border-bottom: 0;
}

.agent-command-name {
  color: var(--qg-violet-bright);
  font: 650 10px/1.5 var(--font-mono);
  overflow-wrap: anywhere;
}

.agent-command-meaning {
  color: var(--qg-muted);
  font-size: 10.5px;
  line-height: 1.5;
}

.agent-command-boundary {
  padding: 15px 2px;
  color: var(--qg-muted);
  border-bottom: 1px solid var(--qg-line);
  font-size: 10.5px;
  line-height: 1.55;
}

/* Panneaux latéraux : le fil reste visuellement présent derrière. */
.modal-overlay:has(.drawer) {
  place-items: stretch end;
  padding: 0;
  background: rgba(5, 5, 8, .58);
}

.modal.drawer {
  width: min(540px, 100vw);
  max-width: none;
  height: 100dvh;
  max-height: none;
  justify-self: end;
  align-self: stretch;
  border-width: 0 0 0 1px;
  border-radius: 22px 0 0 22px;
  background: rgba(24, 22, 31, .985);
  box-shadow: -34px 0 90px -50px #000;
  animation: refined-drawer .22s ease both;
}

@keyframes refined-drawer {
  from { opacity: 0; translate: 12px 0; }
  to { opacity: 1; translate: 0 0; }
}

.drawer .modal-head {
  min-height: 68px;
  padding: 18px 22px 12px;
  border-bottom: 1px solid var(--qg-line);
}

.drawer .modal-title {
  font-size: 18px;
  line-height: 1.35;
}

.drawer .modal-body {
  padding: 20px 22px;
}

.drawer .modal-foot {
  padding: 13px 22px max(18px, env(safe-area-inset-bottom));
  background: rgba(20, 19, 27, .98);
}

.drawer-byline {
  margin-bottom: 14px;
  color: var(--qg-faint);
  font-size: 10px;
}

/* --------------------------------------------------------------------------
   Versions — profil compact, sans mosaïque de cartes
   -------------------------------------------------------------------------- */

.versions-page-head {
  margin-bottom: 15px;
}

.version-tabs {
  border-color: var(--qg-line);
}

.version-tab {
  height: 61px;
  border-right-color: var(--qg-line);
  transition: color .16s ease, background-color .16s ease, opacity .16s ease;
}

.version-tab:hover {
  background: rgba(139, 108, 255, .035);
}

.version-tab.is-active {
  background: linear-gradient(180deg, rgba(139, 108, 255, .08), rgba(139, 108, 255, .025));
}

.version-profile-hero {
  min-height: 148px;
  border-bottom-color: var(--qg-line);
}

.version-profile-description {
  color: var(--qg-muted);
}

.version-profile-status.is-active {
  color: #7edebd;
}

.version-change-list,
.version-activity-list,
.version-feature-list {
  border-top-color: var(--qg-line);
}

.version-change-row,
.version-activity-row,
.version-feature-row {
  border-bottom-color: var(--qg-line);
}

.version-feature-row.is-link:hover,
.version-diff-link:hover {
  padding-left: 3px;
  background: linear-gradient(90deg, rgba(139, 108, 255, .045), transparent 70%);
}

/* --------------------------------------------------------------------------
   Médiathèque — huit albums carrés, 4 × 2 sur grand écran
   -------------------------------------------------------------------------- */

.media-page-head {
  min-height: 68px;
  margin-bottom: 22px;
}

.media-albums-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.media-album {
  aspect-ratio: 1;
  min-width: 0;
  padding: clamp(17px, 1.8vw, 23px);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  color: var(--qg-text);
  border: 1px solid rgba(190, 174, 255, .15);
  border-radius: 24px;
  background:
    radial-gradient(92% 78% at 50% 14%, rgba(139, 108, 255, .16), transparent 66%),
    radial-gradient(80% 70% at 6% 100%, rgba(92, 61, 184, .1), transparent 70%),
    linear-gradient(145deg, rgba(27, 24, 38, .94), rgba(15, 14, 20, .94));
  box-shadow: inset 0 1px rgba(255, 255, 255, .025);
  transition: color .18s ease, border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.media-album::before {
  content: '';
  position: absolute;
  z-index: -1;
  width: 68%;
  aspect-ratio: 1;
  top: 7%;
  left: 16%;
  border: 1px solid rgba(185, 168, 255, .07);
  border-radius: 50%;
  box-shadow:
    0 0 0 24px rgba(139, 108, 255, .018),
    0 0 0 52px rgba(139, 108, 255, .01);
}

.media-album::after {
  content: '';
  position: absolute;
  right: 16%;
  bottom: -1px;
  left: 16%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(185, 168, 255, .42), transparent);
  opacity: .6;
}

.media-album:nth-child(2n)::before {
  top: 13%;
  left: 22%;
}

.media-album:nth-child(3n) {
  background:
    radial-gradient(86% 74% at 22% 8%, rgba(139, 108, 255, .15), transparent 66%),
    radial-gradient(80% 70% at 100% 94%, rgba(92, 61, 184, .09), transparent 70%),
    linear-gradient(145deg, rgba(27, 24, 38, .94), rgba(15, 14, 20, .94));
}

.media-album:hover,
.media-album:focus-visible {
  border-color: rgba(185, 168, 255, .36);
  background-color: rgba(28, 25, 39, .98);
  box-shadow: inset 0 1px rgba(255, 255, 255, .045), 0 20px 50px -42px rgba(139, 108, 255, .75);
}

.media-album-art {
  transform: none !important;
}

.media-album-icon {
  width: clamp(92px, 9vw, 124px);
  height: clamp(92px, 9vw, 124px);
  color: rgba(208, 197, 255, .72);
  filter: drop-shadow(0 8px 24px rgba(72, 45, 151, .16));
  transition: color .18s ease, filter .18s ease;
}

.media-album:hover .media-album-icon,
.media-album:focus-visible .media-album-icon {
  color: #f4f0ff;
  filter: drop-shadow(0 0 9px rgba(139, 108, 255, .48));
}

.media-album-info {
  padding: 10px 2px 1px;
}

.media-album-info b {
  font-size: 15px;
  letter-spacing: -.015em;
}

.media-album-info small {
  margin-top: 3px;
  color: var(--qg-faint);
  font-size: 10px;
}

.media-gallery-bar {
  border-bottom-color: var(--qg-line);
}

.gallery-grid {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 9px;
}

.gallery-thumb {
  border-color: var(--qg-line);
  border-radius: 14px;
}

.gallery-item:hover .gallery-thumb img,
.gallery-item:hover .gallery-thumb video {
  transform: none;
}

.gallery-item:hover .gallery-thumb {
  border-color: rgba(185, 168, 255, .28);
}

.gallery-viewer {
  overflow: hidden;
  border-color: var(--qg-line-strong);
  background: rgba(16, 15, 21, .98);
}

/* --------------------------------------------------------------------------
   Différences — comparaison alignée et lisible
   -------------------------------------------------------------------------- */

.diff-page-head {
  margin-bottom: 16px;
}

.diff-page-intro {
  align-items: baseline;
  gap: 16px;
}

.diff-page-intro p {
  max-width: 760px;
  color: var(--qg-muted);
  font-size: 11.5px;
}

.diff-toolbar {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
  padding: 4px 0;
}

.diff-toolbar .select {
  width: 138px;
  min-width: 138px;
}

.diff-toolbar .search-box-simple {
  flex: 0 1 210px;
}

.diff-aspect-nav {
  flex: 0 0 auto;
}

.diff-section-nav {
  margin-top: 8px;
  border-bottom-color: var(--qg-line);
}

.diff-section-tab {
  height: 41px;
}

.diff-feed {
  display: block;
  padding-top: 13px;
  border-top: 0;
}

.diff-story {
  padding: 18px 3px 16px;
  border: 0;
  border-bottom: 1px solid var(--qg-line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transition: background-color .16s ease;
}

.diff-story:first-child {
  border-top: 1px solid var(--qg-line);
}

.diff-story:hover {
  border-color: var(--qg-line);
  background: linear-gradient(90deg, rgba(139, 108, 255, .045), transparent 78%);
  box-shadow: none;
}

.diff-story > header {
  grid-template-columns: minmax(0, 1fr) 30px;
  gap: 12px;
}

.diff-story-tags {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  overflow: hidden;
}

.diff-story > header > .icon-btn {
  grid-column: 2;
  grid-row: 1;
}

.diff-story-tags .chip {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.diff-story-body {
  margin-top: 11px;
}

.diff-story h2 {
  max-width: 900px;
  font-size: 15.5px;
}

.diff-story .diff-summary {
  max-width: 920px;
  color: var(--qg-muted);
  font-size: 11.5px;
}

.diff-story > footer {
  border-top-color: var(--qg-line);
}

.diff-side {
  min-height: 104px;
  padding: 13px;
  border-color: var(--qg-line);
  border-radius: 13px;
  background: rgba(255, 255, 255, .018);
}

.diff-side p {
  color: var(--qg-muted);
}

/* --------------------------------------------------------------------------
   Infrastructure — trois vues dans la même maison
   -------------------------------------------------------------------------- */

.infra-page-head,
.settings-page-head {
  margin-bottom: 15px;
}

.infra-tabs,
.settings-tabs {
  min-width: 0;
  height: 42px;
  display: flex;
  align-items: stretch;
  gap: 3px;
  margin-bottom: 24px;
  padding: 3px;
  border: 1px solid var(--qg-line);
  border-radius: 13px;
  background: rgba(255, 255, 255, .018);
}

.infra-tab,
.settings-tab {
  min-width: 110px;
  padding: 0 16px;
  border: 0;
  border-radius: 9px;
  color: var(--qg-muted);
  background: transparent;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: color .16s ease, background-color .16s ease, box-shadow .16s ease;
}

.infra-tab:hover,
.settings-tab:hover {
  color: #fff;
  background: rgba(139, 108, 255, .055);
}

.infra-tab.is-active,
.settings-tab.is-active {
  color: #fff;
  background: rgba(139, 108, 255, .16);
  box-shadow: inset 0 0 0 1px rgba(166, 139, 255, .22);
}

.infra-panel-host,
.settings-panel-host {
  min-width: 0;
}

.infra-panel,
.settings-panel {
  min-width: 0;
}

.settings-pin-warning {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px 14px;
  color: var(--qg-muted);
  border: 1px solid rgba(166, 139, 255, .22);
  border-radius: 13px;
  background: rgba(139, 108, 255, .07);
  font-size: 11.5px;
  line-height: 1.55;
}

.settings-pin-warning > span {
  display: inline-flex;
  flex: 0 0 auto;
  color: var(--qg-violet-bright);
}

.settings-pin-warning b {
  color: var(--qg-text);
}

.infra-panel-intro,
.settings-panel > header {
  margin-bottom: 13px;
}

.infra-panel-intro h2,
.settings-panel > header h2 {
  color: var(--qg-text);
  font-size: 18px;
  letter-spacing: -.025em;
}

.infra-panel-intro p,
.settings-panel > header p {
  max-width: 720px;
  margin-top: 4px;
  color: var(--qg-muted);
  font-size: 11px;
  line-height: 1.55;
}

.infra-list,
.settings-list {
  border-top: 1px solid var(--qg-line);
}

.infra-row {
  width: 100%;
  min-height: 76px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto 16px;
  align-items: center;
  gap: 12px;
  padding: 10px 3px;
  color: var(--qg-text);
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--qg-line);
  background: transparent;
  cursor: pointer;
  transition: background-color .16s ease;
}

.infra-row:hover,
.infra-row:focus-visible {
  padding-left: 3px;
  background: linear-gradient(90deg, rgba(139, 108, 255, .05), transparent 72%);
}

.infra-row-icon,
.settings-key-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: var(--qg-violet-bright);
  border-radius: 50%;
  background: rgba(139, 108, 255, .085);
}

.infra-row-copy {
  min-width: 0;
}

.infra-row-copy b,
.infra-row-copy small {
  display: block;
}

.infra-row-copy b {
  font-size: 12.5px;
}

.infra-row-copy small {
  max-width: 660px;
  margin-top: 2px;
  overflow: hidden;
  color: var(--qg-faint);
  font-size: 9.5px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.infra-chevron {
  color: var(--qg-faint);
  font-size: 20px;
}

.plain-state {
  min-height: 23px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  color: var(--qg-muted);
  border: 1px solid var(--qg-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .022);
  font-size: 8.5px;
  font-weight: 700;
  white-space: nowrap;
}

.plain-state i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.plain-state.is-active {
  color: #7edebd;
  border-color: rgba(98, 214, 168, .18);
  background: rgba(98, 214, 168, .055);
}

.plain-state.is-attention {
  color: #e7cd74;
  border-color: rgba(247, 201, 72, .18);
  background: rgba(247, 201, 72, .055);
}

.infra-server-row.is-control {
  margin-top: 14px;
  border-top: 1px dashed var(--qg-line-strong);
}

/* Schéma câblé de l'infrastructure. */
.infra-map .infra-panel-intro {
  margin-bottom: 16px;
}

.map-canvas {
  --map-wire: rgba(185, 168, 255, .46);
  --map-wire-soft: rgba(185, 168, 255, .22);
  min-height: 505px;
  padding: 34px 34px 22px;
  overflow-x: hidden;
  border: 1px solid var(--qg-line);
  border-radius: 22px;
  background:
    linear-gradient(rgba(185, 168, 255, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(185, 168, 255, .025) 1px, transparent 1px),
    radial-gradient(520px 230px at 50% 0, rgba(139, 108, 255, .095), transparent 72%),
    rgba(13, 12, 18, .72);
  background-size: 34px 34px, 34px 34px, auto, auto;
}

.map-product-lanes,
.map-qg-separator,
.map-qg-lane {
  width: 100%;
  min-width: 0;
}

.map-product-lanes {
  border-top: 1px solid var(--qg-line);
}

.map-lane {
  min-height: 106px;
  display: grid;
  grid-template-columns: minmax(86px, .55fr) minmax(170px, .9fr) minmax(54px, .42fr) minmax(360px, 2fr);
  align-items: center;
  gap: 14px;
  position: relative;
  padding: 15px 2px;
  border-bottom: 1px solid var(--qg-line);
}

.map-lane-label {
  color: var(--qg-faint);
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: .1em;
  line-height: 1.35;
  text-transform: uppercase;
}

.map-lane-clients {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.map-client {
  flex: 0 1 auto;
  min-width: 0;
  min-height: 52px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  position: relative;
}

.map-client.is-planned {
  opacity: .52;
}

.map-client .platform-mark {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.map-client b,
.map-client small,
.map-node b,
.map-node small {
  display: block;
}

.map-client b {
  font-size: 11px;
}

.map-client small {
  margin-top: 1px;
  color: var(--qg-faint);
  font-size: 8.5px;
}

.map-lane-cable {
  width: 100%;
  height: 1px;
  position: relative;
  background: linear-gradient(90deg, var(--map-wire-soft), var(--map-wire));
}

.map-lane-cable::after {
  content: '';
  position: absolute;
  top: -3px;
  right: 0;
  width: 6px;
  height: 6px;
  border-top: 1px solid var(--map-wire);
  border-right: 1px solid var(--map-wire);
  transform: rotate(45deg);
}

.map-lane-cable i {
  width: 4px;
  height: 4px;
  position: absolute;
  top: -2px;
  left: 0;
  border-radius: 50%;
  background: var(--qg-violet-bright);
  box-shadow: 0 0 8px rgba(139, 108, 255, .58);
  animation: map-lane-flow 8s linear infinite;
}

.map-lane-cable i:nth-child(2) {
  animation-delay: -2.66s;
}

.map-lane-cable i:nth-child(3) {
  animation-delay: -5.33s;
}

@keyframes map-lane-flow {
  from { left: 0; opacity: 0; }
  12%, 88% { opacity: .75; }
  to { left: calc(100% - 4px); opacity: 0; }
}

.map-lane-destinations {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 10px;
  position: relative;
}

.map-lane-destinations::before {
  content: '';
  position: absolute;
  top: 50%;
  right: 4px;
  left: -14px;
  height: 1px;
  background: var(--map-wire-soft);
}

.map-lane.is-future {
  opacity: .72;
}

.map-lane.is-future .map-lane-cable {
  background: repeating-linear-gradient(to right, var(--map-wire-soft) 0 6px, transparent 6px 12px);
}

.map-lane.is-future .map-lane-cable i {
  display: none;
}

.map-lane.is-future .map-lane-destinations {
  grid-template-columns: minmax(210px, 240px);
}

.map-node {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  position: relative;
  padding: 9px 13px;
  color: var(--qg-text);
  border: 1px solid rgba(185, 168, 255, .13);
  border-radius: 14px;
  background: #13111b;
  box-shadow: 0 0 0 5px rgba(13, 12, 18, .94);
}

.map-node > i {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border: 2px solid var(--qg-violet-bright);
  border-radius: 50%;
  background: var(--qg-bg);
}

.map-node.is-live > i {
  background: var(--qg-violet-bright);
  box-shadow: 0 0 10px rgba(139, 108, 255, .55);
}

.map-node.is-attention > i {
  border-color: var(--yellow);
  background: rgba(247, 201, 72, .16);
}

.map-node.is-planned {
  opacity: .52;
  border-style: dashed;
}

.map-node b {
  font-size: 11px;
}

.map-node small {
  margin-top: 1px;
  color: var(--qg-faint);
  font-size: 8.5px;
}

.map-qg-separator {
  position: relative;
  margin-top: 24px;
  border-top: 1px dashed var(--qg-line-strong);
  text-align: center;
}

.map-qg-separator span {
  position: relative;
  top: -9px;
  padding: 0 10px;
  color: var(--qg-faint);
  background: #0e0d13;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.map-qg-lane {
  display: grid;
  grid-template-columns: minmax(210px, .8fr) minmax(100px, 1.4fr) minmax(180px, .7fr);
  align-items: center;
  gap: 14px;
  padding: 28px 72px 6px;
}

.map-qg-cable {
  height: 1px;
  background: repeating-linear-gradient(to right, var(--map-wire-soft) 0 6px, transparent 6px 12px);
  animation: map-dashes 12s linear infinite;
}

@keyframes map-dashes {
  to { background-position: 72px 0; }
}

.infra-map-note {
  margin-top: 14px;
  color: var(--qg-faint);
  font-size: 9.5px;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Paramètres — onglets et panneaux sobres
   -------------------------------------------------------------------------- */

.settings-tabs {
  width: min(100%, 390px);
  min-width: 0;
}

.settings-tab {
  flex: 1 1 0;
}

.settings-panel {
  max-width: 760px;
}

.settings-form {
  max-width: 660px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 14px;
  padding-top: 4px;
}

.settings-form .field:nth-child(3),
.settings-form .field:nth-child(4) {
  grid-column: 1 / -1;
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--qg-line);
}

.settings-person,
.settings-agent-key {
  min-height: 66px;
  display: grid;
  align-items: center;
  gap: 10px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--qg-line);
}

.settings-person {
  grid-template-columns: 10px minmax(0, 1fr) auto;
}

.settings-agent-key {
  grid-template-columns: 36px minmax(0, 1fr) auto 30px;
}

.settings-person b,
.settings-person small,
.settings-agent-key b,
.settings-agent-key small {
  display: block;
}

.settings-person b,
.settings-agent-key b {
  font-size: 11.5px;
}

.settings-person small,
.settings-agent-key small {
  margin-top: 2px;
  color: var(--qg-faint);
  font-size: 9px;
}

.settings-agent-key .key-val {
  color: var(--qg-faint);
  font: 9px var(--font-mono);
}

.settings-add,
.settings-cli-help {
  margin-top: 16px;
}

.settings-add > summary,
.settings-cli-help > summary {
  list-style: none;
  cursor: pointer;
}

.settings-add > summary::-webkit-details-marker,
.settings-cli-help > summary::-webkit-details-marker {
  display: none;
}

.settings-add > div,
.settings-cli-help > div {
  max-width: 660px;
  margin-top: 12px;
  padding: 15px;
  border: 1px solid var(--qg-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .018);
}

.settings-cli-help > summary {
  width: fit-content;
  color: var(--qg-muted);
  font-size: 10.5px;
  font-weight: 700;
}

.settings-cli-help p,
.settings-cli-help li {
  color: var(--qg-muted);
  font-size: 10.5px;
  line-height: 1.6;
}

.settings-cli-help ul {
  display: grid;
  gap: 5px;
  margin-top: 12px;
  padding-left: 18px;
}

.command-copy {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  align-items: center;
  gap: 8px;
  margin-top: 11px;
  padding: 8px 9px;
  border: 1px solid var(--qg-line);
  border-radius: 10px;
  background: rgba(7, 7, 10, .45);
}

.command-copy code {
  overflow: hidden;
  color: var(--qg-violet-bright);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-key-once p {
  color: var(--qg-muted);
  font-size: 11px;
  line-height: 1.55;
}

.agent-key-once code {
  display: block;
  margin-top: 14px;
  padding: 12px;
  overflow-wrap: anywhere;
  color: var(--qg-violet-bright);
  border: 1px solid rgba(166, 139, 255, .2);
  border-radius: 12px;
  background: rgba(7, 7, 10, .55);
  font: 10px/1.5 var(--font-mono);
}

.settings-empty-line {
  min-height: 80px;
  display: flex;
  align-items: center;
  color: var(--qg-faint);
  border-bottom: 1px solid var(--qg-line);
  font-size: 11px;
}

/* --------------------------------------------------------------------------
   Responsive — navigation rail, puis barre basse
   -------------------------------------------------------------------------- */

@media (max-width: 1100px) {
  :root {
    --sidebar-w: 68px;
  }

  .sidebar {
    width: var(--sidebar-w);
    padding: 16px 8px 12px;
  }

  .brand {
    justify-content: center;
    margin-inline: 0;
    padding-inline: 0;
  }

  .brand > div:last-child,
  .nav-item > span:last-child,
  .nav-sep,
  .user-chip-meta {
    display: none;
  }

  .nav-item {
    width: 42px;
    height: 40px;
    min-height: 40px;
    justify-content: center;
    margin-inline: auto;
    padding: 0;
  }

  .nav-item::before {
    top: 11px;
    bottom: 11px;
    left: -5px;
  }

  .user-chip {
    justify-content: center;
    padding-inline: 0;
  }

  .main {
    padding: 26px 26px 54px;
  }

  .media-albums-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .diff-story > header {
    grid-template-columns: minmax(0, 1fr) 30px;
  }

  .map-canvas {
    padding-inline: 24px;
  }

  .map-lane {
    grid-template-columns: minmax(78px, .5fr) minmax(135px, .85fr) minmax(38px, .32fr) minmax(260px, 1.75fr);
    gap: 10px;
  }
}

@media (max-width: 820px) {
  .main {
    padding-inline: 20px;
  }

  .page-head {
    align-items: flex-start;
  }

  .today-head {
    min-height: 66px;
  }

  .media-albums-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 13px;
  }

  .agent-command-groups {
    display: block;
  }

  .agent-command-group {
    grid-template-columns: minmax(125px, 22%) minmax(0, 1fr);
    gap: 20px;
  }

  .agent-command-row {
    grid-template-columns: minmax(190px, 42%) minmax(0, 1fr);
  }

  .diff-page-intro {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .diff-toolbar {
    flex-wrap: wrap;
  }

  .diff-toolbar .spacer {
    display: none;
  }

  .diff-toolbar .search-box-simple {
    flex: 1 1 190px;
  }

  .diff-story > header {
    grid-template-columns: minmax(0, 1fr) 30px;
  }

  .diff-story-tags {
    grid-column: 1;
    justify-content: flex-start;
  }

  .diff-story > header > .icon-btn {
    grid-column: 2;
    grid-row: 1;
  }

  .settings-form {
    grid-template-columns: 1fr;
  }

  .settings-form .field {
    grid-column: auto !important;
  }

  .map-canvas {
    padding-inline: 24px;
  }

  .map-lane {
    grid-template-columns: minmax(96px, .8fr) minmax(32px, .25fr) minmax(0, 1.7fr);
    gap: 8px;
    padding-block: 17px;
  }

  .map-lane-label {
    grid-column: 1 / -1;
    grid-row: 1;
    padding-bottom: 2px;
  }

  .map-lane-clients {
    grid-column: 1;
    grid-row: 2;
    align-items: stretch;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 7px;
  }

  .map-lane-cable {
    grid-column: 2;
    grid-row: 2;
    width: calc(100% + 16px);
    margin-inline: -8px;
  }

  .map-lane-destinations,
  .map-lane.is-future .map-lane-destinations {
    grid-column: 3;
    grid-row: 2;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .map-lane-destinations::before {
    top: 26px;
    right: auto;
    bottom: 26px;
    left: -8px;
    width: 1px;
    height: auto;
  }

  .map-lane-destinations .map-node::before {
    content: '';
    width: 8px;
    height: 1px;
    position: absolute;
    top: 50%;
    right: 100%;
    background: var(--map-wire-soft);
  }

  .map-lane-destinations .map-node {
    min-width: 0;
    justify-content: flex-start;
    padding-inline: 10px;
    box-shadow: 0 0 0 3px rgba(13, 12, 18, .94);
  }

  .map-qg-lane {
    grid-template-columns: minmax(96px, 1fr) minmax(32px, .45fr) minmax(96px, 1fr);
    gap: 8px;
    padding: 24px 0 6px;
  }
}

@media (max-width: 560px) {
  .agents-page-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .agents-primary-tabs {
    width: 100%;
  }

  .agents-primary-tabs .pill {
    flex: 1 1 0;
    justify-content: center;
  }

  .agent-command-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .agent-command-toolbar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .agent-command-tabs {
    width: 100%;
    overflow-x: auto;
  }

  .agent-command-toolbar .spacer {
    display: none;
  }

  .agent-command-search {
    width: auto;
    flex: 1 1 210px;
  }

  .agent-command-group {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .agent-command-group > header {
    padding-bottom: 12px;
  }
}

@media (max-width: 720px) {
  :root {
    --sidebar-w: 0px;
  }

  .shell {
    display: block;
  }

  .sidebar {
    width: 100%;
    height: calc(66px + env(safe-area-inset-bottom));
    min-height: 0;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 2px;
    position: fixed;
    inset: auto 0 0;
    z-index: 80;
    padding: 7px 8px env(safe-area-inset-bottom);
    overflow-x: auto;
    overflow-y: hidden;
    border-top: 1px solid var(--qg-line-strong);
    border-right: 0;
    background: rgba(12, 11, 16, .96);
    box-shadow: 0 -18px 48px -35px #000;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar::-webkit-scrollbar {
    display: none;
  }

  .brand,
  .nav-sep {
    display: none;
  }

  .sidebar-foot {
    flex: 0 0 72px;
    margin: 0;
    padding: 0;
    border-top: 0;
  }

  .sidebar-foot .user-chip {
    width: 72px;
    height: 52px;
    min-height: 52px;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    margin: 0;
    padding: 0 4px;
    color: var(--qg-muted);
    text-align: center;
  }

  .sidebar-foot .user-dot {
    display: none;
  }

  .sidebar-foot .user-chip-settings {
    display: inline-flex;
  }

  .sidebar-foot .user-chip-mobile-label {
    width: 100%;
    display: block;
    overflow: hidden;
    font-size: 8px;
    font-weight: 650;
    line-height: 1.05;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sidebar .nav-item {
    width: 72px;
    height: 52px;
    min-height: 52px;
    flex: 0 0 72px;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    margin: 0;
    padding: 0 4px;
    scroll-snap-align: center;
  }

  .sidebar .nav-item > span:last-child {
    width: 100%;
    display: block;
    overflow: hidden;
    font-size: 8px;
    font-weight: 650;
    line-height: 1.05;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sidebar .nav-item::before {
    width: 20px;
    height: 2px;
    top: auto;
    right: auto;
    bottom: 0;
    left: calc(50% - 10px);
  }

  .shell-content {
    width: 100%;
  }

  .main {
    padding: 20px 16px calc(92px + env(safe-area-inset-bottom));
  }

  .page-head {
    min-height: 0;
    margin-bottom: 17px;
  }

  .page-head h1 {
    font-size: 25px;
  }

  .page-intro {
    font-size: 10.5px;
  }

  .today-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .today-head h1 {
    font-size: 30px;
  }

  .today-head .btn {
    width: 36px;
    padding: 0;
    font-size: 0;
  }

  .today-head .btn svg {
    width: 16px;
    height: 16px;
  }

  .today-layout {
    gap: 30px;
  }

  .today-section-head {
    align-items: flex-start;
  }

  .today-counts {
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .journal-toolbar-simple,
  .agent-toolbar-simple {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 7px 0 10px;
    background: transparent;
    backdrop-filter: none;
  }

  .journal-toolbar-simple .filter-pills,
  .agent-toolbar-simple .filter-pills {
    grid-column: 1 / -1;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }

  .journal-toolbar-simple .filter-pills::-webkit-scrollbar,
  .agent-toolbar-simple .filter-pills::-webkit-scrollbar {
    display: none;
  }

  .journal-toolbar-simple .spacer,
  .agent-toolbar-simple .spacer {
    display: none;
  }

  .journal-toolbar-simple .search-box,
  .journal-toolbar-simple .search-box .input,
  .agent-toolbar-simple .search-box,
  .agent-toolbar-simple .search-box .input {
    width: 100%;
  }

  .journal-entry,
  .agent-entry {
    grid-template-columns: 32px minmax(0, 1fr) 12px;
    gap: 10px;
  }

  .journal-entry {
    padding: 14px 12px;
  }

  .journal-entry:hover,
  .journal-entry:focus-visible {
    padding-left: 12px;
  }

  .agent-entry {
    padding: 15px 1px;
  }

  .journal-entry-icon,
  .agent-entry-avatar {
    width: 31px;
    height: 31px;
  }

  .journal-entry h2,
  .agent-entry h3 {
    font-size: 13.5px;
  }

  .journal-entry-main > p {
    font-size: 10.8px;
    -webkit-line-clamp: 2;
  }

  .modal-overlay:has(.drawer) {
    padding: 0;
  }

  .modal.drawer {
    width: 100vw;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .modal-foot,
  .drawer .modal-foot {
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .modal-foot .btn {
    max-width: 100%;
  }

  .media-albums-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .media-album {
    padding: 13px;
    border-radius: 18px;
  }

  .media-album-icon {
    width: clamp(68px, 23vw, 92px);
    height: clamp(68px, 23vw, 92px);
  }

  .media-album-info b {
    font-size: 12px;
  }

  .media-album-info small {
    font-size: 8.5px;
  }

  .media-gallery-bar {
    min-height: 62px;
    gap: 8px;
  }

  .media-gallery-bar .btn {
    padding-inline: 10px;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .diff-toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .diff-toolbar .compare-word,
  .diff-toolbar-divider {
    display: none;
  }

  .diff-toolbar > .select {
    width: 100%;
    min-width: 0;
  }

  .diff-aspect-nav,
  .diff-toolbar .search-box-simple {
    width: 100%;
    grid-column: 1 / -1;
  }

  .diff-toolbar .search-box-simple .input {
    width: 100%;
  }

  .diff-toolbar > .filter-menu {
    width: 100%;
    grid-column: 1 / -1;
  }

  .diff-toolbar > .filter-menu > summary,
  .diff-toolbar > .filter-menu > div {
    width: 100%;
  }

  .diff-toolbar > .filter-menu > div {
    right: 0;
    left: 0;
  }

  .diff-story {
    padding: 15px 1px;
  }

  .diff-story > footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .diff-story-actions {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .infra-tabs,
  .settings-tabs {
    width: 100%;
    min-width: 0;
  }

  .infra-tab,
  .settings-tab {
    min-width: 0;
    flex: 1 1 0;
    padding-inline: 8px;
  }

  .infra-row {
    grid-template-columns: 34px minmax(0, 1fr) 14px;
    gap: 10px;
  }

  .infra-row .plain-state {
    grid-column: 2;
    width: fit-content;
    margin-top: -7px;
  }

  .infra-row .infra-chevron {
    grid-column: 3;
    grid-row: 1 / 3;
  }

  .infra-row-icon {
    width: 32px;
    height: 32px;
    grid-row: 1 / 3;
  }

  .map-canvas {
    min-height: 470px;
    padding: 28px 18px 20px;
  }

  .settings-agent-key {
    grid-template-columns: 34px minmax(0, 1fr) 28px;
  }

  .settings-agent-key .key-val {
    display: none;
  }

  .settings-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-actions .btn {
    width: 100%;
  }
}

@media (max-width: 430px) {
  .main {
    padding-inline: 13px;
  }

  .today-row {
    grid-template-columns: 31px minmax(0, 1fr) 12px;
    gap: 9px;
  }

  .today-row-icon {
    width: 30px;
    height: 30px;
  }

  .media-albums-grid {
    gap: 8px;
  }

  .media-album {
    padding: 10px;
    border-radius: 16px;
  }

  .media-album-info {
    padding-top: 6px;
  }

  .media-gallery-bar h1 {
    font-size: 18px;
  }

  .media-gallery-bar .btn {
    font-size: 9px;
  }

  .modal-foot,
  .drawer .modal-foot {
    padding-inline: 14px;
  }

  .map-canvas {
    padding: 22px 12px 18px;
  }

  .map-lane {
    grid-template-columns: minmax(78px, .72fr) 22px minmax(0, 1.55fr);
    gap: 6px;
  }

  .map-lane-cable {
    width: calc(100% + 12px);
    margin-inline: -6px;
  }

  .map-lane-destinations::before {
    left: -6px;
  }

  .map-lane-destinations .map-node::before {
    width: 6px;
  }

  .map-node {
    padding: 8px;
  }

  .map-node b,
  .map-client b {
    font-size: 10px;
  }

  .map-node small,
  .map-client small {
    font-size: 7.8px;
  }

  .map-qg-lane {
    grid-template-columns: minmax(0, 1fr) 22px minmax(0, 1fr);
    gap: 6px;
  }

  .plain-state {
    font-size: 7.5px;
  }
}

/* --------------------------------------------------------------------------
   Mouvement réduit
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
