/* AlphaVoices mobile overflow fixes */

@media (max-width: 750px) {

  .shell,
  .main,
  .top,
  .sidegrid,
  .section,
  .sectionbar,
  .chartcard,
  .chartwrap,
  .alpha-consensus,
  .horizon-consensus,
  .hc-card {
    min-width: 0;
    max-width: 100%;
  }

  .main {
    width: 100%;
  }

  .top,
  .controls,
  .sectionbar,
  .filters {
    min-width: 0;
  }

  .controls,
  .filters {
    flex-wrap: wrap;
  }

  .filters .select {
    min-width: 0;
    max-width: 100%;
    flex: 1 1 125px;
  }

  .chartcard,
  .chartwrap {
    width: 100%;
  }

  .chart {
    max-width: 100%;
  }

  .hc-card,
  .ccard,
  .aside {
    overflow-wrap: anywhere;
  }

  .hc-targets,
  .hc-changes,
  .alpha-changes {
    min-width: 0;
  }

  .table {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tr,
  .tr.resolvedrow {
    grid-template-columns:
      minmax(85px, 110px)
      minmax(0, 1fr)
      minmax(65px, 85px);
    min-width: 0;
  }

  .tr > *,
  .voice,
  .predtitle {
    min-width: 0;
  }


  .voice,
  .predtitle,
  .excerpt {
    overflow-wrap: anywhere;
  }

  .tooltip {
    max-width: calc(100vw - 24px);
    overflow-wrap: anywhere;
  }

}

@media (max-width: 380px) {

  .main {
    padding: 10px;
  }

  .tr,
  .tr.resolvedrow {
    grid-template-columns:
      minmax(75px, 95px)
      minmax(0, 1fr)
      minmax(60px, 75px);
    gap: 5px;
    padding: 9px 6px;
  }

  .controls {
    gap: 6px;
  }

  .pill,
  .select {
    padding: 7px 8px;
  }

}

/* Restore Top Voices on tablets and mobile */
@media (max-width: 1050px) {
  .sidegrid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .sidegrid > .aside#voices {
    display: block !important;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    height: auto;
  }

  #ratings {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 16px;
  }

  #ratings .rating {
    min-width: 0;
  }
}

@media (max-width: 600px) {
  #ratings {
    grid-template-columns: minmax(0, 1fr);
  }
}
