  /* ---- Apps: the grid, the tiles' menus, the sections, arranging ---- */
  #moduleNav[hidden], .apps-held[hidden], .app-tile-wrap[hidden] { display: none; }
  /* the Shop's New or Update on Apps' link; the held-back line. */
  .pp-links .tag { margin-left: 6px; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-text); }
  .pp-links .tag:empty { display: none; }
  .apps-held { display: block; margin: 12px 0 0; }
  @media (max-width: 820px) {
    #appsArrangeBar { bottom: calc(var(--places-h, 60px) + env(safe-area-inset-bottom) + 10px); } /* above the bar at the bottom (the id: the general rule comes later) */
  }
  /* the Apps grid (a letter on a color from the id), each tile's "⋯" menu, and Your groups (the switcher's sheet on a
     phone). Theme tokens only. */
  #appsPage { display: none; }
  body.apps-open #appsPage { display: block; }
  .apps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 14px 8px; margin: 20px 0 16px; }
  .app-tile-wrap { position: relative; }
  .app-tile { width: 100%; min-height: 44px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px 8px; background: none; border: 0; border-radius: var(--r-md); color: var(--ink); font: inherit; font-size: 13px; line-height: 1.25; cursor: pointer; }
  .app-tile:hover { background: var(--hover-wash); }
  .app-icon { width: 56px; height: 56px; border-radius: var(--r-lg); display: grid; place-items: center; font-weight: 600; font-size: 22px; background: var(--card); color: var(--ink); border: 2px solid var(--line-strong); }
  .app-icon.a1 { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); } .app-icon.a2 { border-color: var(--ok-text); }
  .app-icon.a3 { border-color: var(--danger); } .app-icon.a4 { border-style: dashed; border-color: var(--accent); } .app-icon.a5 { border-style: dashed; border-color: var(--ok-text); background: var(--accent-soft); color: var(--accent-text); }
  .app-icon.more { border-style: dashed; color: var(--ink-soft); font-size: 26px; }
  /* a module's own icon fills its square; the Shop's row has a smaller one before its name */
  .app-icon.has-img { background: none; border-color: transparent; overflow: hidden; }
  .app-icon > img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
  /* a dot where a module's chat has news: its menu entry, its Apps tile, and on its page Chat's switch, the chat icon
     and the right column's Chat (the pill's dot and the group's own stay the group chat's) */
  #moduleNav .nav-item.chat-news:not(.has-update):not(.is-new)::after,
  .app-tile.chat-news .app-icon::after,
  #topCalChatBtn.has-new::after, #sideChatBtn.has-new::after { content: ""; box-sizing: border-box; border-radius: var(--r-round); background: var(--accent); border: 2px solid var(--paper); flex: none; }
  #moduleNav .nav-item.chat-news:not(.has-update):not(.is-new)::after, #topCalChatBtn.has-new::after, #sideChatBtn.has-new::after { width: 10px; height: 10px; } /* 12px on an app's icon, below */
  .app-tile.chat-news .app-icon { position: relative; overflow: visible; }
  .app-tile.chat-news .app-icon::after { position: absolute; top: -4px; right: -4px; width: 12px; height: 12px; }
  .app-name { text-align: center; overflow-wrap: anywhere; }
  .app-badge { font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--accent-text); border: var(--bw) var(--bs) var(--accent); border-radius: var(--r-xs); padding: 0 5px; }
  .app-badge.stopped { color: var(--ink); border-color: var(--danger); }
  .app-badge:empty { display: none; } /* Get more's badge, with nothing to say */
  .app-more { position: absolute; top: 0; right: 0; width: 36px; height: 36px; border-radius: var(--r-round); border: 0; background: none; color: var(--ink-soft); font-size: 18px; line-height: 1; cursor: pointer; }
  .app-more:hover, .app-more[aria-expanded="true"] { background: var(--hover-wash-strong); color: var(--ink); }
  .app-menu { position: absolute; z-index: 30; top: 38px; min-width: 220px; max-width: calc(100vw - 32px); background: var(--card); color: var(--ink); border: var(--bw) var(--bs) var(--line-strong); border-radius: var(--r-md); box-shadow: var(--shadow-panel); padding: 6px 0; }
  .app-menu[hidden] { display: none; }
  .app-menu button { display: block; width: 100%; min-height: 40px; text-align: left; background: none; border: 0; padding: 9px 14px; font: inherit; font-size: 14px; color: var(--ink); cursor: pointer; }
  .app-menu button:hover, .app-menu button:focus { background: var(--hover-wash-strong); }
  .app-menu .app-menu-icon { display: inline-grid; width: 20px; height: 20px; margin: 0 10px 0 0; vertical-align: -5px; border-radius: var(--r-sm); border-width: 1px; font-size: 11px; }
  .app-menu .app-menu-icon[data-letter]::before { content: attr(data-letter); }
  /* Apps' sections, its arranging (each app's ⋯ only then, the wiggle, a drag, the hidden apps at the end), the small
     square of an app with a card on Today, and the Projects page. */
  /* the sections as chips: smaller, rounded, the one showing filled with the Look's soft accent, in one row that scrolls
     sideways on a phone; the favorites first, a thin line under them, and while arranging a softly tinted box labeled
     Favorites. */
  .apps-sections { display: flex; flex-wrap: nowrap; gap: 6px; margin: 14px 0 0; padding: 2px 0 4px; max-width: 100%; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .apps-sections::-webkit-scrollbar { display: none; }
  .apps-chip { flex: 0 0 auto; min-height: 32px; padding: 5px 12px; border: var(--bw) var(--bs) var(--line-strong); border-radius: var(--r-pill); background: var(--card); color: var(--ink); font: inherit; font-size: 13px; line-height: 1.2; white-space: nowrap; cursor: pointer; }
  .apps-chip:hover { background: var(--hover-wash-strong); }
  .apps-fav-box { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); grid-template-columns: subgrid; gap: 14px 8px; padding: 0 0 14px; border-bottom: var(--bw) var(--bs) var(--line-strong); }
  .apps-fav-label, .apps-fav-empty { display: none; }
  body.apps-arranging .apps-fav-box { padding: 6px 6px 8px; border: var(--bw) var(--bs) var(--accent-soft); border-radius: var(--r-lg); background: var(--accent-soft); }
  body.apps-arranging .apps-fav-label { display: block; grid-column: 1 / -1; padding: 2px 6px 0; color: var(--accent-text); font-size: 13px; font-weight: 600; }
  body.apps-arranging .apps-fav-box.empty .apps-fav-empty { display: block; grid-column: 1 / -1; padding: 4px 6px 10px; color: var(--ink); font-size: 13px; }
  .apps-sections[hidden], .apps-arrange-bar[hidden] { display: none; }
  /* the arranging bar sits at the bottom, as Edit layout's does, so the apps stay where they are when it shows */
  .apps-arrange-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 40; width: 540px; max-width: calc(100vw - 24px); box-sizing: border-box; padding: 10px 14px; border: var(--bw) var(--bs) var(--line-strong); border-radius: var(--r-md); background: var(--card); color: var(--ink); box-shadow: var(--shadow-panel); }
  body.apps-arranging #appsPage { padding-bottom: 150px; }
  .apps-arrange-bar .hint { margin: 0; flex: 1 1 220px; }
  #appsState:empty { display: none; }
  #appsState { flex: 1 1 100%; margin: 0; }
  .app-more { display: none; }
  body.apps-arranging .app-more { display: grid; place-items: center; }
  .app-tile, .app-tile-wrap { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
  .app-tile img { -webkit-user-drag: none; }
  body.apps-arranging .app-tile-wrap[data-key] { touch-action: none; cursor: grab; }
  body.apps-dragging, body.apps-dragging .app-tile-wrap { cursor: grabbing; }
  body.apps-arranging .app-tile-wrap[data-key]:not(.app-hidden):not(.dragging) .app-icon { animation: app-wiggle .28s ease-in-out infinite alternate; }
  .app-tile-wrap[data-key]:nth-child(2n) .app-icon { animation-delay: -.14s; }
  @keyframes app-wiggle { from { transform: rotate(-2deg); } to { transform: rotate(2deg); } }
  @media (prefers-reduced-motion: reduce) { body.apps-arranging .app-tile-wrap .app-icon { animation: none !important; } }
  .app-tile-wrap.dragging .app-tile { background: var(--hover-wash-strong); outline: 2px dashed var(--accent); outline-offset: -2px; }
  .app-tile-wrap.app-hidden .app-icon { border-style: dashed; filter: grayscale(1); }
  .app-widget { position: absolute; top: 52px; left: calc(50% + 17px); width: 14px; height: 14px; box-sizing: border-box; border-radius: var(--r-xs); border: 2px solid var(--accent); background: var(--paper); pointer-events: none; }
  .app-widget.on { background: var(--accent); }
