/* WINGEATS phone layer for the application.
 *
 * The application is a desktop dashboard: its own stylesheet has one narrow
 * variant (max-width 1024px) that only shrinks the navigation icons, and
 * every screen is a fixed three-column layout (80px nav, 260px secondary
 * column, body). On a phone that leaves the body a sliver 60-150px wide,
 * which is what one-letter-per-line text and a crushed calendar look like.
 *
 * This file restructures every screen below 900px without touching the
 * vendor's code or removing anything:
 *   - the navigation column becomes a bottom bar that scrolls sideways
 *     through ALL its items;
 *   - the secondary column (Channels, Settings menu, Integrations list)
 *     becomes a row above the body;
 *   - the body takes the full width, headings drop to phone sizes,
 *     grids become one or three columns, the calendar's week and month
 *     grids keep legible columns and swipe sideways;
 *   - dialogs, popovers, toasts and drawers fit the screen.
 *
 * Every selector below is written against the structure the box measured
 * at 390px (deploy/brand/capture.sh MOBILE OUTLINE, 2026-09-22); the class
 * names are the vendor's own Tailwind classes, matched by substring so a
 * rebuild that reorders them still matches. Desktop is untouched.
 */

@media (max-width: 900px) {

  /* ── Page shell ─────────────────────────────────────────────────────── */
  html, body { max-width: 100% !important; overflow-x: hidden !important; }
  body { overflow-wrap: break-word; }

  /* The root column (p-[12px]) and the nav+main row (gap-[8px]). */
  div[class*="min-h-screen"][class*="min-w-screen"][class*="p-[12px]"] {
    padding: 0 !important;
  }
  div[class*="min-h-screen"][class*="min-w-screen"] > div[class*="flex-1"][class*="gap-[8px]"] {
    flex-direction: column !important;
    gap: 0 !important;
    padding-bottom: 68px !important;   /* room for the bottom bar */
  }

  /* ── Navigation: the 80px column becomes a bottom bar ───────────────── */
  div[class*="w-[80px]"][class*="bg-newBgColorInner"][class*="rounded-[12px]"] {
    width: 0 !important; min-width: 0 !important; height: 0 !important;
    overflow: visible !important; border-radius: 0 !important;
  }
  div[class*="fixed"][class*="w-[64px]"][class*="h-full"] {
    top: auto !important; bottom: 0 !important; left: 0 !important; right: 0 !important;
    inset-inline-start: 0 !important;
    width: 100% !important; height: 64px !important; z-index: 60 !important;
    background: var(--new-bgColorInner) !important;
    border-top: 1px solid var(--new-border) !important;
    padding-bottom: env(safe-area-inset-bottom, 0) !important;
  }
  div[class*="fixed"][class*="w-[64px]"] > div[class*="gap-[32px]"][class*="py-[12px]"] {
    flex-direction: row !important; align-items: center !important;
    gap: 0 !important; padding: 0 6px !important; height: 64px !important; width: 100% !important;
    overflow-x: auto !important; overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  div[class*="fixed"][class*="w-[64px]"] > div[class*="gap-[32px]"]::-webkit-scrollbar { display: none; }
  div[class*="fixed"][class*="w-[64px]"] img[class*="min-w-[60px]"] {
    width: 36px !important; height: 36px !important; min-width: 36px !important; min-height: 36px !important;
    margin: 0 6px 0 4px !important; flex: none !important;
  }
  /* Both link groups (main items, then Settings) sit in the same row. */
  div[class*="fixed"][class*="w-[64px]"] div[class*="blurMe"] {
    flex-direction: row !important; flex: none !important; gap: 0 !important;
  }
  div[class*="fixed"][class*="w-[64px]"] a[class*="minCustom:h-[54px]"] {
    display: flex !important; flex-direction: column !important; align-items: center !important; justify-content: center !important;
    width: auto !important; min-width: 62px !important; height: 56px !important;
    padding: 6px 4px !important; flex: none !important; border-radius: 10px !important;
  }
  div[class*="fixed"][class*="w-[64px]"] a[class*="minCustom:h-[54px]"] div[class*="text-[9px]"],
  div[class*="fixed"][class*="w-[64px]"] a[class*="minCustom:h-[54px]"] div[class*="text-[10px]"] {
    font-size: 10px !important; line-height: 1.1 !important; white-space: nowrap !important;
  }

  /* ── Main column ───────────────────────────────────────────────────── */
  div[class*="bg-newBgLineColor"][class*="rounded-[12px]"][class*="overflow-hidden"] {
    border-radius: 0 !important; min-height: calc(100vh - 68px) !important;
  }
  /* Page header: 80px tall with a 24px title on desktop. */
  div[class*="bg-newBgColorInner"][class*="h-[80px]"][class*="px-[20px]"] {
    height: 56px !important; min-height: 56px !important; padding: 0 14px !important;
    position: sticky !important; top: 0 !important; z-index: 40 !important;
  }
  div[class*="h-[80px]"][class*="px-[20px]"] div[class*="text-[24px]"] { font-size: 20px !important; }
  div[class*="h-[80px]"][class*="px-[20px]"] div[class*="gap-[20px]"] { gap: 12px !important; }

  /* Content row: secondary column above the body instead of beside it. */
  div[class*="bg-newBgLineColor"] > div[class*="flex-1"][class*="gap-[1px]"] {
    flex-direction: column !important;
  }
  /* Secondary column (Channels list, Settings menu, Integrations list). */
  div[class*="gap-[1px]"] > div[class*="w-[260px]"] {
    width: 100% !important; min-width: 0 !important; flex: none !important;
    padding: 10px 14px !important;
  }
  /* Its lists become rows that wrap or scroll. */
  div[class*="gap-[1px]"] > div[class*="w-[260px]"] div[class*="gap-[12px]"][class*="flex-col"] {
    flex-direction: row !important; flex-wrap: wrap !important; align-items: center !important; gap: 6px 10px !important;
  }
  div[class*="gap-[1px]"] > div[class*="w-[260px]"] div[class*="gap-[12px]"][class*="flex-col"] > div[class*="items-center"]:first-child {
    width: 100% !important;
  }
  div[class*="gap-[1px]"] > div[class*="w-[260px]"] div[class*="group/profile"] {
    width: auto !important; flex: 0 0 auto !important; max-width: 100% !important; padding: 6px 10px !important;
  }
  div[class*="gap-[1px]"] > div[class*="w-[260px]"] div[class*="whitespace-nowrap"][class*="text-ellipsis"] {
    max-width: 180px !important;
  }
  /* The Settings menu (a column of 8 rows) scrolls sideways. */
  div[class*="gap-[1px]"] > div[class*="w-[260px]"] > div[class*="flex-1"][class*="flex-col"][class*="gap-[15px]"] {
    flex-direction: row !important; overflow-x: auto !important; gap: 4px !important; padding-bottom: 4px !important;
    -webkit-overflow-scrolling: touch;
  }
  div[class*="gap-[1px]"] > div[class*="w-[260px]"] > div[class*="flex-1"][class*="flex-col"][class*="gap-[15px]"] > div {
    flex: none !important; white-space: nowrap !important;
  }
  /* The calendar's Channels column is absolutely positioned inside a
     260px box; on a phone it is a normal block above the calendar. */
  div[class*="gap-[1px]"] > div[class*="relative"][class*="flex-col"][class*="w-[260px]"] {
    height: auto !important; min-height: 0 !important;
  }
  div[class*="gap-[1px]"] > div[class*="w-[260px]"] > div[class*="absolute"][class*="overflow-y-auto"] {
    position: static !important; height: auto !important; width: 100% !important;
    padding: 10px 14px !important; overflow: visible !important; gap: 8px !important;
  }
  div[class*="gap-[1px]"] > div[class*="w-[260px]"] div[class*="gap-[32px]"][class*="select-none"][class*="flex-1"] {
    gap: 8px !important;
  }
  div[class*="gap-[1px]"] > div[class*="w-[260px]"] div[class*="gap-[32px]"][class*="select-none"] > div[class*="gap-[16px]"][class*="flex-col"] {
    flex-direction: row !important; flex-wrap: wrap !important; gap: 8px !important;
  }
  div[class*="gap-[1px]"] > div[class*="w-[260px]"] div[class*="gap-[8px]"][class*="flex-col"][class*="group-[.sidebar]:mx-auto"] {
    flex-direction: row !important; flex-wrap: wrap !important; align-items: center !important;
  }
  div[class*="gap-[1px]"] > div[class*="w-[260px]"] div[class*="mt-[5px]"][class*="text-center"][class*="flex-col"] {
    margin: 0 !important; font-size: 11px !important; opacity: .6;
  }
  /* The collapsed ("sidebar") mode makes no sense as a row: show labels. */
  div[class*="gap-[1px]"] > div.sidebar { width: 100% !important; }
  div[class*="gap-[1px]"] > div.sidebar [class*="group-[.sidebar]:hidden"] { display: block !important; }
  div[class*="gap-[1px]"] > div.sidebar [class*="group-[.sidebar]:w-[44px]"] { width: auto !important; }

  /* Page body. */
  div[class*="gap-[1px]"] > div[class*="flex-1"][class*="p-[20px]"][class*="gap-[12px]"] {
    padding: 12px 14px !important; min-width: 0 !important;
  }

  /* ── Screens ───────────────────────────────────────────────────────── */
  /* Integrations: four cards a row on desktop. */
  div[class*="grid-cols-4"][class*="justify-items-center"] {
    grid-template-columns: 1fr !important; justify-items: stretch !important;
  }
  /* Analytics cards (already 1 column below 640px); the range picker is fine. */
  /* Media grid and any other wide grid: three columns on a phone. */
  div[class*="grid-cols-5"], div[class*="grid-cols-6"], div[class*="grid-cols-8"]:not([class*="grid-rows"]) {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
  /* Calendar, week view: 136px time column + 7 days. Keep the columns
     legible and let the grid swipe sideways (it is its own scroller). */
  div[class*="grid-template-columns:136px"] {
    grid-template-columns: 56px repeat(7, minmax(112px, 1fr)) !important;
  }
  /* Month view: 7 columns, same idea. */
  div[class*="grid-cols-7"][class*="grid-rows-[62px_auto]"] {
    grid-template-columns: repeat(7, minmax(96px, 1fr)) !important;
  }
  /* The view switcher (Day / Week / Month) and the date range stack. */
  div[class*="md:flex-row"][class*="items-center"][class*="select-none"] { align-items: stretch !important; }
  div[class*="md:flex-row"][class*="items-center"][class*="select-none"] > div { justify-content: center !important; }

  /* ── Text that was sized for a wide body ───────────────────────────── */
  div[class*="gap-[1px]"] h1, div[class*="gap-[1px]"] h2 { font-size: 20px !important; }
  div[class*="gap-[1px]"] [class*="text-[24px]"] { font-size: 20px !important; }
  div[class*="gap-[1px]"] [class*="text-[28px]"], div[class*="gap-[1px]"] [class*="text-[32px]"] { font-size: 22px !important; }
  div[class*="gap-[1px]"] [class*="text-[48px]"], div[class*="gap-[1px]"] [class*="text-[40px]"], div[class*="gap-[1px]"] [class*="text-[36px]"] { font-size: 22px !important; line-height: 1.3 !important; }
  /* Empty-state illustrations stay a picture, not a screen. */
  /* Only illustrations: a channel row (Analytics, Agent) is also a centred
     flex row with an image in a box, and this rule blew its 34px avatar up
     to 178px (measured 2026-09-22); rounded images are avatars, not art. */
  div[class*="gap-[1px]"] div[class*="items-center"][class*="justify-center"]:not([class*="group/profile"]) > div:not([class*="rounded"]) > img:not([class*="rounded"]) { max-height: 180px !important; width: auto !important; margin: 0 auto; }
  /* Content images shrink to the screen; sized images (avatars, icons,
     w-[..]/h-[..] classes) keep their size (measured: a 34px avatar grew to
     the row width when height was set to auto). */
  div[class*="gap-[1px]"] img:not([class*="w-["]):not([class*="h-["]):not([class*="rounded-full"]):not([class*="rounded-[8px]"]) { max-width: 100% !important; height: auto; }

  /* ── Fixed-width elements from the vendor bundle ───────────────────── */
  [class*="w-["]:not([class*="w-[6px]"]):not([class*="w-[4px]"]):not([class*="w-[1px]"]), [class*="min-w-["] { max-width: 100vw !important; }
  table { display: block !important; max-width: 100% !important; overflow-x: auto !important; }
  .bp5-dialog { width: calc(100vw - 16px) !important; margin: 8px auto !important; }
  .bp5-popover-content, .bp5-popover-content-sizing { width: auto !important; max-width: calc(100vw - 16px) !important; }
  .bp5-toast { min-width: 0 !important; max-width: calc(100vw - 16px) !important; }
  .bp5-drawer { width: 100vw !important; }
  .bp5-menu { max-width: calc(100vw - 16px) !important; }
  [role="dialog"] { max-width: 100vw !important; }
  /* The post editor and other modals: full screen on a phone. */
  div[class*="fixed"][class*="inset-0"] > div[class*="w-["], div[class*="fixed"][class*="left-0"][class*="top-0"] > div[class*="w-["] {
    width: 100vw !important; max-width: 100vw !important; max-height: 100vh !important; border-radius: 0 !important;
  }
}

/* ── Second pass (measured on capture 20260922-121212) ───────────────── */
@media (max-width: 900px) {
  /* All eight items of the bar fit a 390px screen without scrolling. */
  div[class*="fixed"][class*="w-[64px]"] a[class*="minCustom:h-[54px]"] { min-width: 0 !important; padding: 4px 0 !important; }
  /* Measured at 390px (capture 133738): the eight items plus the mark took
     about 411px, Settings sat 20px past the edge. The labels are what
     stretches ("Integrations" 73px), so every label, whatever its class,
     is 10px with tight tracking: the row then needs about 350px. */
  div[class*="fixed"][class*="w-[64px]"] a[class*="minCustom:h-[54px]"] > div:last-child,
  div[class*="fixed"][class*="w-[64px]"] a[class*="minCustom:h-[54px]"] > div:last-child * { font-size: 10px !important; letter-spacing: -0.25px !important; white-space: nowrap !important; line-height: 1.1 !important; }
  /* The icon box is 42px wide on desktop and set the floor for the short
     items (Agent, Media, Plugs, Review measured 42 with 29-39px labels);
     on a phone it is the icon plus 4px each side. Tested locally in
     headless Chromium: a later rule had reset the tracking to 0, hence
     the two rules agree now. */
  div[class*="fixed"][class*="w-[64px]"] a[class*="minCustom:h-[54px]"] > div:first-child { width: auto !important; min-width: 0 !important; height: auto !important; padding: 2px 4px !important; margin: 0 !important; }
  /* Measured after that (capture 135609): the short items still came out
     42px wide with 28-38px labels, so the floor is set elsewhere in the
     item; the icon box is now a fixed 30px square around a 22px icon and
     nothing in the item keeps a minimum. Sum at 390px: 335px of items,
     28px mark, 4px padding. */
  div[class*="fixed"][class*="w-[64px]"] a[class*="minCustom:h-[54px]"] { width: auto !important; max-width: none !important; flex: 0 0 auto !important; }
  div[class*="fixed"][class*="w-[64px]"] a[class*="minCustom:h-[54px]"] > * { min-width: 0 !important; width: auto !important; max-width: none !important; }
  div[class*="fixed"][class*="w-[64px]"] a[class*="minCustom:h-[54px]"] > div:first-child { width: 30px !important; height: 30px !important; padding: 0 !important; display: flex !important; align-items: center !important; justify-content: center !important; }
  div[class*="fixed"][class*="w-[64px]"] a[class*="minCustom:h-[54px]"] > div:first-child svg { width: 22px !important; height: 22px !important; min-width: 0 !important; }
  div[class*="fixed"][class*="w-[64px]"] a[class*="minCustom:h-[54px]"] div[class*="text-[9px]"],
  div[class*="fixed"][class*="w-[64px]"] a[class*="minCustom:h-[54px]"] div[class*="text-[10px]"] { font-size: 10px !important; letter-spacing: -0.25px !important; }
  div[class*="fixed"][class*="w-[64px]"] img[class*="min-w-[60px]"] { width: 24px !important; height: 24px !important; min-width: 24px !important; min-height: 24px !important; margin: 0 2px !important; }
  div[class*="fixed"][class*="w-[64px]"] > div[class*="gap-[32px]"][class*="py-[12px]"] { padding: 0 2px !important; justify-content: space-between !important; }

  /* Channel rows in the secondary column read as chips, two to a line. */
  div[class*="gap-[1px]"] > div[class*="w-[260px]"] div[class*="whitespace-nowrap"][class*="text-ellipsis"] { max-width: 110px !important; }
  div[class*="gap-[1px]"] > div[class*="w-[260px]"] div[class*="gap-[32px]"][class*="select-none"] > div[class*="gap-[16px]"][class*="flex-col"] > * {
    width: auto !important; flex: 0 0 auto !important; max-width: 48% !important;
  }
  div[class*="gap-[1px]"] > div[class*="w-[260px]"] div[class*="gap-[32px]"][class*="select-none"] [class*="line-clamp-1"] { max-width: 110px !important; }
  /* The calendar's action buttons: Add Channel and the link button on one
     line (no wrapped labels), Create Post full width under them. */
  div[class*="gap-[1px]"] > div[class*="w-[260px]"] div[class*="gap-[8px]"][class*="group-[.sidebar]:mx-auto"] > div { flex: 1 1 100% !important; flex-wrap: nowrap !important; }
  div[class*="gap-[1px]"] > div[class*="w-[260px]"] div[class*="gap-[8px]"][class*="group-[.sidebar]:mx-auto"] button { white-space: nowrap !important; }
  div[class*="gap-[1px]"] > div[class*="w-[260px]"] div[class*="gap-[8px]"][class*="group-[.sidebar]:mx-auto"] > div > *:first-child { flex: 1 1 auto !important; }
  div[class*="gap-[1px]"] > div[class*="w-[260px]"] div[class*="gap-[8px]"][class*="group-[.sidebar]:mx-auto"] > div > * + * { flex: 0 0 auto !important; }
  /* The calendar's channel list: one compact row per channel (two columns
     left the names two letters wide, measured). */
  div[class*="gap-[1px]"] > div[class*="w-[260px]"] div[class*="gap-[32px]"][class*="select-none"] > div[class*="gap-[16px]"][class*="flex-col"] {
    display: flex !important; flex-direction: column !important; gap: 0 !important;
  }
  div[class*="gap-[1px]"] > div[class*="w-[260px]"] div[class*="gap-[32px]"][class*="select-none"] > div[class*="gap-[16px]"][class*="flex-col"] > * > * { padding-top: 2px !important; padding-bottom: 2px !important; }
  div[class*="gap-[1px]"] > div[class*="w-[260px]"] div[class*="flex"][class*="items-center"]:has(> h2) { display: flex !important; width: 100% !important; justify-content: space-between !important; }
  div[class*="gap-[1px]"] > div[class*="w-[260px]"] div[class*="flex"][class*="items-center"] > h2[class*="flex-1"] { flex: 1 1 auto !important; }
  /* Editor toolbar rows wrap instead of clipping their last button; the
     assistant bubble keeps clear of the footer buttons. */
  div[class*="bg-popup"] div[class*="bg-newSettings"] div[class*="flex"][class*="gap-"]:has(> button + button) { flex-wrap: wrap !important; }
  /* The text box's own toolbar (media, signature, underline, bold, emoji,
     and a last button) is a flex row of small squares that clipped its last
     button at 390px (measured: about 10px of it showed). Any such row in
     the dialog wraps, whatever its container is called. */
  div[class*="bg-popup"] div[class*="flex"]:has(> button + button + button), div[class*="bg-popup"] div[class*="flex"]:has(> div + div + div > button) { flex-wrap: wrap !important; row-gap: 6px !important; overflow: visible !important; }
  /* Measured (capture 133738): the text box is 366px wide, its editor
     column 329px beside a 32px arrow column, and the toolbar's eight
     squares need about 352px, so the last one was cut. Every row inside
     the text box may wrap except the editor/arrows row itself (gap-[5px]). */
  div[class*="bg-popup"] div[class*="bg-newSettings"] div[class*="flex"]:not([class*="flex-col"]):not([class*="gap-[5px]"]) { flex-wrap: wrap !important; row-gap: 6px !important; }
  /* Measured (capture 134712, dialog tree): the toolbar's last group
     (flex-1 justify-end, holding the red button) has flex-basis 0, so the
     row never wrapped; it was squeezed to 11px and its button showed as a
     red sliver. Its size is its content now; when the row is full it
     drops to a second line, kept to the right. */
  div[class*="bg-popup"] div[class*="bg-newSettings"] div[class*="flex-1"][class*="justify-end"] { flex: 0 0 auto !important; margin-inline-start: auto !important; }
  /* The assistant bubble goes to the top right of the dialog, beside its
     title, so it never covers Save or the calendar button in the footer. */
  div[class*="bg-popup"] .copilotKitPopup .copilotKitButton { top: 6px !important; bottom: auto !important; right: 10px !important; width: 40px !important; height: 40px !important; }
  div[class*="bg-popup"] .copilotKitWindow { top: 52px !important; bottom: auto !important; max-height: calc(100vh - 60px) !important; }
  div[class*="gap-[1px]"] > div[class*="w-[260px]"] div[class*="gap-[32px]"][class*="select-none"] > div[class*="gap-[16px]"][class*="flex-col"] > * {
    width: auto !important; max-width: 100% !important; min-width: 0 !important; margin: 0 !important;
  }
  div[class*="gap-[1px]"] > div[class*="w-[260px]"] div[class*="gap-[32px]"][class*="select-none"] [class*="line-clamp-1"] { max-width: 100% !important; }

  /* Settings: a label beside a 200px control becomes a label above it. */
  form div[class*="justify-between"][class*="gap-[24px]"]:has(> div[class*="w-[200px]"]) { flex-direction: column !important; align-items: stretch !important; gap: 8px !important; }
  form div[class*="justify-between"][class*="gap-[24px]"] > div[class*="w-[200px]"] { width: 100% !important; }
  /* Settings: a label beside a select becomes a label above it. */
  form div[class*="flex"]:has(> select), form div[class*="flex"]:has(> div > select) { flex-direction: column !important; align-items: stretch !important; gap: 8px !important; }
  form div[class*="flex"]:has(> select) > *, form div[class*="flex"]:has(> div > select) > * { width: 100% !important; max-width: 100% !important; }

  /* ── The post editor (and every dialog built the same way) ───────────── */
  div[class*="fixed"][class*="bg-popup"] > div[class*="relative"][class*="flex-1"] { width: 100% !important; max-width: 100vw !important; }
  div[class*="bg-popup"] div[class*="p-[40px]"][class*="relative"] { padding: 0 !important; }
  div[class*="bg-popup"] div[class*="bg-newBgColorInner"][class*="rounded-[20px]"][class*="flex-col"] {
    border-radius: 0 !important; height: 100% !important; max-height: 100vh !important; overflow-y: auto !important; -webkit-overflow-scrolling: touch;
  }
  div[class*="bg-popup"] div[class*="rounded-[20px]"][class*="flex-col"] > div[class*="flex-1"][class*="flex"]:first-child { flex-direction: column !important; }
  /* Nothing inside the dialog may be wider than the screen (measured: the
     footer row was 427px because a flex child kept its desktop minimum). */
  div[class*="bg-popup"] div[class*="rounded-[20px]"][class*="flex-col"] { width: 100vw !important; max-width: 100vw !important; overflow-x: hidden !important; }
  div[class*="bg-popup"] div[class*="rounded-[20px]"][class*="flex-col"] * { max-width: 100% !important; min-width: 0 !important; }
  div[class*="bg-popup"] div[class*="border-e"][class*="border-newBorder"][class*="flex-col"] { border-inline-end: 0 !important; width: 100% !important; flex: none !important; }
  div[class*="bg-popup"] div[class*="h-[65px]"] { height: 52px !important; border-radius: 0 !important; padding: 0 14px !important; }
  div[class*="bg-popup"] div[class*="gap-[32px]"][class*="absolute"][class*="ps-[20px]"] { position: static !important; height: auto !important; padding: 12px !important; gap: 14px !important; width: 100% !important; }
  div[class*="bg-popup"] div[class*="bg-newSettings"][class*="rounded-t-[12px]"] { width: 100% !important; max-width: 100% !important; }
  div[class*="bg-popup"] div[class*="relative"][class*="flex-col"][class*="gap-[20px]"][class*="flex-1"] { width: 100% !important; max-width: 100% !important; }
  div[class*="bg-popup"] div[class*="w-[580px]"] { width: 100% !important; border-top: 1px solid var(--new-border) !important; }
  div[class*="bg-popup"] div[class*="w-[580px]"] div[class*="absolute"][class*="overflow-x-hidden"] { position: static !important; height: auto !important; max-height: 45vh !important; padding: 12px !important; }
  div[class*="bg-popup"] div[class*="h-[84px]"][class*="border-t"] {
    height: auto !important; flex-wrap: wrap !important; padding: 10px 12px !important; gap: 8px !important;
    position: sticky !important; bottom: 0 !important; background: var(--new-bgColorInner) !important; z-index: 5 !important;
  }
  div[class*="bg-popup"] div[class*="h-[84px]"] > div[class*="ps-[20px]"], div[class*="bg-popup"] div[class*="h-[84px]"] > div[class*="pe-[20px]"] {
    padding: 0 !important; flex-wrap: wrap !important; width: 100% !important; justify-content: flex-start !important; gap: 8px !important;
  }
  div[class*="bg-popup"] div[class*="h-[44px]"][class*="rounded-[8px]"] { width: auto !important; }
  div[class*="bg-popup"] div[class*="h-[44px]"] div[class*="cursor-pointer"] { white-space: nowrap !important; height: auto !important; }
  div[class*="bg-popup"] button[class*="min-w-[180px]"] { min-width: 0 !important; flex: 1 1 auto !important; }
  div[class*="bg-popup"] button[class*="h-[44px]"] div { white-space: nowrap !important; height: auto !important; }
  /* The calendar itself gets most of the screen: its grid is absolutely
     positioned inside a flex-1 box, so that box needs a real height once the
     channels panel sits above it instead of beside it. */
  div[class*="gap-[1px]"] > div[class*="flex-1"][class*="p-[20px]"] div[class*="flex-1"][class*="relative"]:has(> div[class*="absolute"][class*="overflow-auto"]) {
    min-height: calc(100vh - 150px) !important;
  }
  div[class*="gap-[1px]"] > div[class*="w-[260px]"] > div[class*="absolute"][class*="overflow-y-auto"] { padding: 8px 12px !important; gap: 6px !important; }
  div[class*="gap-[1px]"] > div[class*="w-[260px]"] h2[class*="text-[20px]"] { font-size: 16px !important; }
  /* The Agent page: its channel picker and conversation list are 260px
     columns with absolutely positioned content (20px tall on a phone). Both
     become normal blocks around the chat, which keeps most of the screen. */
  div[class*="gap-[1px]"] > div[class*="relative"][class*="w-[260px]"] > div[class*="absolute"][class*="overflow-auto"] {
    position: static !important; height: auto !important; width: 100% !important; padding: 10px 14px !important; overflow: visible !important;
  }
  div[class*="gap-[1px]"] > div[class*="relative"][class*="w-[260px]"] div[class*="flex-col"][class*="gap-[15px]"] {
    flex-direction: row !important; flex-wrap: wrap !important; gap: 6px 10px !important;
  }
  div[class*="gap-[1px]"] > div[class*="relative"][class*="w-[260px]"] h2[class*="mb-[15px]"] { margin-bottom: 4px !important; }
  div[class*="gap-[1px]"] > div[class*="flex-1"]:has(> div[class*="agent"]) { min-height: 60vh !important; }
  div[class*="agent"][class*="items-center"] > div[class*="absolute"][class*="pb-[20px]"] { position: static !important; min-height: 60vh !important; }
  /* Media library: eight thumbnails a row (w8-max) become three. */
  div[class*="w8-max"][class*="aspect-square"] { width: 33.333% !important; max-width: 33.333% !important; }
  div[class*="withp3"][class*="overflow-y-auto"] { position: static !important; height: auto !important; min-height: 50vh !important; }
  ul[class*="flex-row"][class*="items-center"][class*="justify-center"][class*="mt-[15px]"] { flex-wrap: wrap !important; }
  /* The AI assistant bubble sits above the bottom bar, not on it. */
  .copilotKitPopup .copilotKitButton { bottom: 80px !important; }
  .copilotKitWindow { bottom: 80px !important; max-height: calc(100vh - 100px) !important; width: calc(100vw - 16px) !important; }
}

/* Very narrow phones. */
@media (max-width: 400px) {
  /* No minimum: this 42px floor (kept from an earlier pass) is what held
     the short items at 42px on a 390px phone (capture 135609); items are
     as wide as their labels, the icon box being 30px. */
  div[class*="fixed"][class*="w-[64px]"] a[class*="minCustom:h-[54px]"] { min-width: 0 !important; }
  /* Measured (capture 140633): the row fit exactly (390 in 390) with items
     as wide as their labels, so labels touched and three items were under
     32px. Eight equal items share the row instead (about 44px each, a
     finger's width), and labels are set 14% narrower, like a condensed
     face, so the longest ("Integrations", 64px) overhangs its box by a
     few px into its neighbours' margins without touching them. */
  /* Capture 141352 (equal 45px items): the row fit and every tap was a
     finger wide, but the active pill is the item's box, so "Integrations"
     lost its first and last letters against the dark bar when it was the
     page. Items size to their labels (at least 34px) and share the spare
     room, so the pill always holds its whole label: 331px of labels and
     floors, 28px mark, 27px spare at 390px. */
  div[class*="fixed"][class*="w-[64px]"] a[class*="minCustom:h-[54px]"] { flex: 1 1 auto !important; width: auto !important; min-width: 34px !important; padding: 4px 0 !important; overflow: visible !important; }
  div[class*="fixed"][class*="w-[64px]"] div[class*="blurMe"] { flex: 1 1 auto !important; display: flex !important; }
  div[class*="fixed"][class*="w-[64px]"] div[class*="blurMe"] + div[class*="blurMe"] { flex: 0 1 auto !important; }
  div[class*="fixed"][class*="w-[64px]"] a[class*="minCustom:h-[54px]"] > div:last-child { overflow: visible !important; width: auto !important; max-width: none !important; }
}
/* Narrower still (360px phones): the labels are set 8% narrower so the
   same eight items fit without touching. */
@media (max-width: 370px) {
  div[class*="fixed"][class*="w-[64px]"] a[class*="minCustom:h-[54px]"] > div:last-child { transform: scaleX(0.92) !important; transform-origin: center !important; }
  div[class*="fixed"][class*="w-[64px]"] a[class*="minCustom:h-[54px]"] { min-width: 32px !important; }
  div[class*="grid-template-columns:136px"] { grid-template-columns: 48px repeat(7, minmax(104px, 1fr)) !important; }
}
