/* Mobile card layout for /overview (Funnel by app).
 * Converts the wide table into stacked app cards: label left, value right, section dividers.
 * Breakpoint: portrait phones (≤768px) and phone landscape (≤932px wide, ≤500px tall). */
@media (max-width: 768px), (max-width: 932px) and (max-height: 500px) {
  .overview-table-wrap {
    overflow-x: visible;
    max-width: 100%;
  }

  .overview-table.overview-table-wide {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    border: none;
    background: transparent;
    overflow: visible;
  }

  .overview-table thead {
    display: none;
  }

  .overview-table tbody {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    width: 100%;
  }

  .overview-table .funnel-row {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
    padding: 0.65rem 0.75rem;
    overflow: hidden;
  }

  .overview-table .funnel-row td {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 0.35rem 0.75rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    border: none;
    padding: 0.28rem 0;
    text-align: right;
    font-variant-numeric: tabular-nums;
    min-width: 0;
  }

  .overview-table .funnel-row td:first-child {
    display: block !important;
    grid-template-columns: unset;
    padding-bottom: 0.45rem;
    border-bottom: 1px dashed var(--border);
    margin-bottom: 0.35rem;
    text-align: left;
  }

  .overview-table .funnel-row td:first-child .funnel-app-link {
    display: inline;
    word-break: break-word;
  }

  .overview-table .funnel-row td:first-child .muted {
    margin-top: 0.2rem;
    word-break: break-all;
    font-size: 0.75rem;
  }

  .overview-table .funnel-row td:first-child .funnel-gap-badge {
    display: inline-block;
    margin: 0.25rem 0 0;
  }

  .overview-table .funnel-row td[data-col]::before {
    content: attr(data-label);
    grid-column: 1;
    grid-row: 1;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.3;
    text-align: left;
    font-weight: 500;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .overview-table .funnel-row td[data-col] .funnel-cell {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    align-items: flex-end;
    min-width: 0;
    max-width: 100%;
  }

  .overview-table .funnel-row td.overview-section-col--start {
    position: relative;
    margin-top: 0.45rem;
    padding-top: 1.45rem;
    border-top: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  }

  .overview-table .funnel-row td.overview-section-col--start::after {
    content: attr(data-section-label);
    position: absolute;
    top: 0.35rem;
    left: 0;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
  }

  .overview-table .funnel-row td.overview-section-col--start.overview-section-col--discovery::after {
    color: #93c5fd;
  }

  .overview-table .funnel-row td.overview-section-col--start.overview-section-col--installs::after {
    color: #6ee7b7;
  }

  .overview-table .funnel-row td.overview-section-col--start.overview-section-col--subscriptions::after {
    color: #fcd34d;
  }

  .overview-table .funnel-row td.overview-section-col--start.overview-section-col--retention::after {
    color: #cbd5e1;
  }

  .overview-table .funnel-row td:first-child + td.overview-section-col--start {
    margin-top: 0;
    padding-top: 0.28rem;
    border-top: none;
  }

  .overview-table .funnel-row td:first-child + td.overview-section-col--start::after {
    display: none;
  }

  .overview-table .funnel-row td.overview-section-col {
    border-left: none;
  }

  .overview-table .funnel-row td.col-conversion,
  .overview-table .funnel-row td.col-conversion--ratio {
    background: transparent;
  }
}
