/* Contenu adapté à la largeur réelle de l'écran, widgets, dock, états vides */

.screen { container: screen / inline-size; }
@container screen (max-width: 820px) {
  .profile { grid-template-columns: 170px minmax(0, 1fr); }

  .grid3 { grid-template-columns: minmax(0, 1fr); }
  .charts { grid-template-columns: minmax(0, 1fr); }
}
@container screen (max-width: 680px) {
  .profile { grid-template-columns: 112px minmax(0, 1fr); gap: 16px; }
  .profile__name { font-size: 2rem; }
  .facts { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .facts .wide { grid-column: auto; }

  .mug__change { opacity: 1; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 14px 16px; }
  .tile dd { font-size: 1.875rem; }
  #auto-tiles .tile dd { font-size: 1.5rem; }
  .card { padding: 18px; }
  .card--flush { padding: 0; }
  .mini-list li { grid-template-columns: 20px 44px minmax(0, 1fr); row-gap: 6px; }
  .mini-list .status { grid-column: 3; justify-self: start; }
  .bars { height: 170px; gap: 4px; }
  .bars__label { font-size: 0.625rem; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px 16px; }
  .stat__value { font-size: 2rem; }
  .view__head { flex-wrap: wrap; }
  .org__tier { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .org__tier:not(:first-child)::before { left: 50%; }
  .org__rank { justify-self: center; }
  .org__row { padding: 8px; gap: 8px; }
  .org__node { width: 100%; }
  .org__tools { opacity: 1; }
  .timeline::before { left: 19px; }
  .tl__item { grid-template-columns: 32px minmax(0, 1fr); gap: 12px; }
  .tl__dot { width: 32px; height: 32px; }
  .tl__dot .ticon { width: 16px; height: 16px; }

  /* tableau des coups -> liste de cartes */
  .table { min-width: 0; }
  .table, .table tbody { display: block; }
  .table thead { display: none; }
  .table tr.row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
  }
  .table tr.row td { display: block; padding: 0; border: 0; background: none; grid-column: 1; }
  .table tr.row[aria-expanded="true"] { background: var(--panel-2); border-bottom-color: transparent; }
  .table tr.row td.date { grid-row: 1; font-size: 0.8125rem; }
  .table tr.row td:has(.status) { grid-column: 2; grid-row: 1; justify-self: end; }
  .table tr.row td.charge-cell { display: flex; margin: 2px 0 4px; grid-column: 1 / -1; }
  .table tr.row td[data-label] { font-size: 0.875rem; color: var(--muted); }
  .table tr.row td[data-label]::before { content: attr(data-label) " : "; font-weight: 600; }
  .table tr.row td.penalty:not(.penalty--none) { color: var(--text); }
  .table tr.row td:has(.row-actions) { grid-column: 1 / -1; margin-top: 6px; }
  .table tr.detail { display: block; background: var(--panel-2); border-bottom: 1px solid var(--line); }
  .table tr.detail td { display: block; padding: 0 16px 12px; border: 0; }
  .table tr.detail td:empty { display: none; }
}

.phone .screen { overflow-y: auto; }
.sbar .sys { display: block; }
.sbar .net { display: inline; }
.home__date { display: block; }
@media (min-width: 521px) {
  body[data-mode="public"] { display: grid; place-items: center; padding: 20px; }
}

/* Fiche sur le téléphone */
@container screen (max-width: 480px) {
  .profile { grid-template-columns: 104px minmax(0, 1fr); column-gap: 14px; row-gap: 0; }
  .profile__body { display: contents; }
  .mug { grid-row: 1 / span 3; align-self: start; }
  .profile__name { font-size: 1.75rem; align-self: end; }
  .facts { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
  .facts .wide { grid-column: 1 / -1; }
  .facts dd { font-size: 1rem; }
}
.phone .screen, .phone .home { scrollbar-width: none; }
.phone .screen::-webkit-scrollbar, .phone .home::-webkit-scrollbar { display: none; }

/* Accueil : widget, points de page et dock */
.widget--small {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 150px;
  padding: 14px 16px;
}
.widget__label { display: flex; align-items: center; gap: 6px; margin-bottom: auto; color: var(--muted); font-size: 0.8125rem; font-weight: 700; }
.widget__label svg { width: 16px; height: 16px; fill: none; stroke: #ff5a60; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.widget__line { color: rgba(236, 236, 238, 0.72); font-size: 0.8125rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.widget__avatars { display: flex; margin: 12px 0 4px; padding-left: 8px; }
.widget__avatars .avatar { width: 36px; height: 36px; margin-left: -8px; font-size: 0.875rem; border: 2px solid #1a1b1f; background: #2c2e34; }
.widget__avatars .avatar:first-child { background: var(--red); }
.avatar--more { color: var(--muted); font-family: var(--body); font-size: 0.75rem !important; }

.home .apps { margin-top: 2px; }
/* widget Gang : 2×2 cases */
.apps > .widget { grid-column: span 2; grid-row: span 2; min-height: 0; align-self: stretch; }
.home__dots { display: flex; justify-content: center; gap: 7px; margin-top: auto; padding-top: 6px; }
.home__dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, 0.3); }
.home__dots i:first-child { background: #fff; }
.dock {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: -8px -8px 0;
  padding: 14px 10px;
  border-radius: 32px;
  background: rgba(30, 31, 36, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.07);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  backdrop-filter: blur(22px) saturate(1.4);
}
/* noms du dock masqués */
.dock .app__name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.home { padding-bottom: 30px; }

/* États vides illustrés */
.void {
  grid-column: 1 / -1;
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 44px 24px 40px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: radial-gradient(80% 60% at 50% 0%, rgba(227, 36, 43, 0.07), transparent 70%);
}
.void__icon {
  display: grid;
  place-items: center;
  width: 72px; height: 72px;
  margin-bottom: 16px;
  border-radius: 22px;
  background: var(--red-soft);
  box-shadow: inset 0 0 0 1px rgba(227, 36, 43, 0.3);
}
.void__icon svg { width: 34px; height: 34px; fill: none; stroke: #ff5a60; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.void__title { margin: 0; font-family: var(--head); font-weight: 700; font-size: 1.5rem; line-height: 1.1; }
.void__text { margin: 6px 0 0; max-width: 30ch; color: var(--muted); }
.void--caisses .void__icon { background: rgba(78, 163, 239, 0.14); box-shadow: inset 0 0 0 1px rgba(78, 163, 239, 0.3); }
.void--caisses .void__icon svg { stroke: #6db4f2; }
.void--chrono .void__icon { background: rgba(111, 124, 255, 0.14); box-shadow: inset 0 0 0 1px rgba(111, 124, 255, 0.3); }
.void--chrono .void__icon svg { stroke: #8f99ff; }
.void--stats .void__icon { background: rgba(167, 125, 255, 0.14); box-shadow: inset 0 0 0 1px rgba(167, 125, 255, 0.3); }
.void--stats .void__icon svg { stroke: #b796ff; }
.void--coups .void__icon { background: var(--amber-soft); box-shadow: inset 0 0 0 1px rgba(240, 167, 58, 0.3); }
.void--coups .void__icon svg { stroke: var(--amber); }
.card--flush > #incidents-empty:not(.empty) { padding: 12px; }
.card--flush > #incidents-empty .void { border: 0; }
.table[hidden] { display: none !important; }
.timeline > .void { margin-left: -4px; }
.timeline:has(> .void)::before { display: none; }
.toolbar[hidden] { display: none; }

/* accueil sans défilement */
.home { gap: 16px; padding-top: 10px; }
.home__time { font-size: 4.5rem; }
.widget--small { min-height: 128px; }
.apps { row-gap: 16px; }

@container screen (max-width: 680px) {
  .tiles > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
/* Stats : 4 tuiles automatiques */
#auto-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@container screen (max-width: 680px) {
  #auto-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
