@layer components {
  /* The agent conversation's chat bubble belongs to the phone's Accueil only. */
  .nav-conversation-icon { display: none; }

  /* Accueil on a phone or a tablet: the sidebar's favorites, places and private conversations as 48 px rows. */
  @media (max-width: 1099px) {
    /* The header and the Tout / Non lus chips stay put: only the lists scroll, and iOS bounces them even when they
       are shorter than the screen (their body is one pixel taller than their box). */
    .app-shell[data-screen="home"] { height: 100vh; height: 100dvh; }
    /* Under a support or quota banner, the shell takes what the banner leaves, however tall its text wraps. */
    body:has(> :is(.support-banner, .quota-banner, .admin-banner)):has(> .app-shell[data-screen="home"]) {
      display: flex; flex-direction: column; height: 100vh; height: 100dvh;
    }
    body:has(> :is(.support-banner, .quota-banner, .admin-banner)) > .app-shell[data-screen="home"] { flex: 1; min-height: 0; height: auto; }
    .app-shell[data-screen="home"] .app-sidebar { flex: 1; min-height: 0; padding-bottom: 0; }
    .app-shell[data-screen="home"] :is(.sidebar-nav, .chat-nav) { flex: 1; min-height: 0; overflow: hidden; }
    .app-shell[data-screen="home"] .sidebar-nav { padding-bottom: 0; }
    .app-shell[data-screen="home"] .chat-nav { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
    .app-shell[data-screen="home"] .chat-nav-lists {
      /* The rows reach into the navigation's 8 px padding (their hover background): the box spans it too. */
      display: block; flex: 1; min-height: 0; margin-inline: -8px; padding-inline: 8px;
      overflow-y: auto; overscroll-behavior-y: contain;
    }
    .app-shell[data-screen="home"] .chat-nav-lists-body {
      display: flex; flex-direction: column; min-height: calc(100% + 1px);
      padding-bottom: calc(var(--tab-bar-height) + var(--tab-bar-bottom) + 24px);
    }
    .app-shell[data-screen="home"] [data-nav-group="search"] { display: none; }
    .app-shell[data-screen="home"] [data-nav-group="favorites"]:has(#sidebar_favorites > li) { display: contents; }
    .app-shell[data-screen="home"] .app-main { padding-bottom: 0; }
    .app-shell[data-screen="home"] :is(.chat-nav, .sidebar-list, .nav-section > .sidebar-list, .nav-group-row > .sidebar-list) {
      gap: 0; margin-top: 0;
    }

    /* Rows: 48 px, a 16 px label in the foreground colour, 10 px between the marker and the label. */
    .app-shell[data-screen="home"] .chat-nav .sidebar-link {
      min-height: 48px; gap: 10px; font-size: calc(var(--text-body) * 16 / 15); color: var(--foreground);
    }
    .app-shell[data-screen="home"] .chat-nav .sidebar-link > svg:first-child { width: 16px; height: 16px; margin: 0; }
    .app-shell[data-screen="home"] .chat-nav .sidebar-link > .type-icon--channel { width: 16px; margin: 0; }
    .app-shell[data-screen="home"] .nav-project > .nav-row-head .sidebar-label { font-weight: 600; }
    .app-shell[data-screen="home"] .nav-project-icon svg { width: 16px; height: 16px; }
    .app-shell[data-screen="home"] .nav-row-head > svg:last-child, .app-shell[data-screen="home"] .nav-row-chevron > svg { width: 14px; height: 14px; }
    .app-shell[data-screen="home"] .nav-conversation-icon { display: inline-flex; flex: none; }

    /* Children start under their parent's label (the marker at 50 px, the label at 76 px). */
    .app-shell[data-screen="home"] .chat-nav :is(.nav-project, .nav-agent) > .sidebar-list > li > .sidebar-link {
      padding-left: 42px; gap: 10px;
    }
    .app-shell[data-screen="home"] .nav-agent-new, .app-shell[data-screen="home"] .nav-agent-new .sidebar-label {
      color: var(--foreground);
    }

    /* An unread row says so with a 7 px dot at its right edge (and the hidden text for screen readers). */
    .app-shell[data-screen="home"] .sidebar-entry .sidebar-count { display: none; }
    .app-shell[data-screen="home"] .sidebar-entry.is-unread .sidebar-dot { display: block; }
    .app-shell[data-screen="home"] .sidebar-dot { width: 7px; height: 7px; margin: 0 0 0 auto; }

    /* « Voir toutes les conversations » and « Tous les messages privés »: a muted 15 px label, its count, a chevron. */
    .app-shell[data-screen="home"] .chat-nav :is(.sidebar-link--muted, .nav-privates-all) { gap: 8px; color: var(--muted-foreground); }
    .app-shell[data-screen="home"] .chat-nav :is(.sidebar-link--muted, .nav-privates-all) .sidebar-label {
      flex: none; font-size: var(--text-body);
    }
    .app-shell[data-screen="home"] :is(.nav-more-count, .nav-privates-count) { font-size: calc(var(--text-meta) * 14 / 13); }
    .app-shell[data-screen="home"] .chat-nav :is(.sidebar-link--muted, .nav-privates-all) > svg:last-child {
      width: 16px; height: 16px; margin-left: auto;
    }

    /* Section heading: 48 px, its text 4 px below centre; the « + » is a 44 px touch area around a 24 px square. */
    .app-shell[data-screen="home"] .chat-nav .nav-section-head { min-height: 48px; padding: 4px 0 0 8px; gap: 8px; }
    .app-shell[data-screen="home"] .nav-section-toggle { min-height: 44px; }
    .app-shell[data-screen="home"] .nav-section-toggle svg { width: 14px; height: 14px; }
    .app-shell[data-screen="home"] .nav-section-head .sidebar-add {
      position: relative; width: 44px; height: 44px; margin: 0 -2px 0 0; border-radius: 0; background: transparent;
    }
    .app-shell[data-screen="home"] .nav-section-head .sidebar-add::before {
      content: ""; position: absolute; top: 10px; left: 10px; width: 24px; height: 24px; box-sizing: border-box;
      border: 1px solid var(--border); border-radius: 6px;
    }
    .app-shell[data-screen="home"] .nav-section-head .sidebar-add:is(:hover, :active)::before { background: var(--sidebar-accent); }
    .app-shell[data-screen="home"] .nav-section-head .sidebar-add svg { position: relative; }

    /* The row's ⋯ shows while its row has the focus, centred on the 48 px row. */
    .app-shell[data-screen="home"] .nav-row-actions { top: 17px; }
    /* A project's chevron is a 44 px button on the 48 px head only, not the whole group: its ⋯ and its name make room. */
    .app-shell[data-screen="home"] .nav-project > .nav-row-chevron { width: 44px; height: 48px; }
    .app-shell[data-screen="home"] .nav-project > .nav-row-actions { right: 44px; }
    .app-shell[data-screen="home"] .nav-project > .nav-row-head { padding-right: 44px; }
  }
}
