/* Data uses the available workspace; reading surfaces and PDF paper keep their own measure. */
.library-content { max-width: none; }
.library-content > .wrap { width: 100%; }
.card-info, .card-info-slot { display: none !important; }
.filter-disclosure-icon { display: none; }
#toolbarView:not(:has(> :not([hidden]))), #toolbarPeriod:not(:has(> :not([hidden]))) { display: none; }

@media (min-width: 1440px) {
  .library-content { padding-inline: 32px; }
}

@media (max-width: 767px) {
  .library-content { padding-inline: 16px; }
  .library-mobile-bar { gap: 8px; min-height: 52px; }
  .library-mobile-bar .mobile-brand-title { text-align: start; white-space: normal; line-height: 1.3; }
  .library-heading { gap: 8px; padding-block: 4px 8px; margin-bottom: 0; flex-wrap: wrap; }
  .library-heading .hdr-lead { flex: 1 1 120px; }
  .hdr .stamp { font-size: 11px; }
  .hdr .library-actions { gap: 4px; flex: 0 1 auto; min-width: 0; }
  .hdr .user-menu { flex: 0 1 auto; min-width: 0; }
  .hdr .user-menu > .account-button { padding-inline: 10px; }
  .hdr .user-menu > .account-button .account-label { font-size: 13px; }
  .library-content > .wrap { padding-top: 8px; }
  .section-title { margin-bottom: 14px; font-size: 1.75rem; line-height: 1.2; letter-spacing: -.015em; }

  /* Filters sit beside the platform control; the two periods share one row. */
  #toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  #toolbarPeriod, #toolbarSecondary, #compareCustomRow { grid-column: 1 / -1; }
  #toolbarView { grid-column: 1; grid-row: 1; }
  #toolbarView .segmented > button { padding-inline: 4px; font-size: 14px; }
  #toolbarPeriod { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 8.5rem), 1fr)); gap: 8px; }
  #toolbarPeriod .filter-field { width: 100%; min-width: 0; }
  #toolbarPeriod .popup, #toolbarPeriod .select-trigger {
    min-height: 52px; height: auto; padding: 8px 10px; gap: 4px; font-size: .8125rem;
  }
  #toolbar .popup, #toolbar .select-trigger, #toolbar .search-field input { border-radius: 14px; }
  #toolbarPeriod .popup-text, #toolbarPeriod .select-text { min-width: 0; }
  #toolbarPeriod .select-value, #dateLbl { white-space: normal; line-height: 1.3; }
  #toolbarPeriod .select-sub { font-size: .6875rem; line-height: 1.4; white-space: normal; overflow: visible; text-overflow: clip; }
  #toolbarPeriod .glyph { width: 12px; height: 12px; flex: none; }
  #toolbarMore { grid-column: 2; grid-row: 1; width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%; }
  #toolbarMore > span { display: none; }
  #toolbarMore .filter-disclosure-icon { display: block; width: 21px; height: 21px; }
  #toolbarMore[aria-expanded="true"] { color: var(--accent-text); background: var(--glass-hover); }
  #toolbarTrailing { grid-column: 1 / -1; width: 100%; min-width: 0; }
  #toolbarTrailing .client-context { gap: 8px; }
  #toolbarTrailing .context-field { flex: 1 1 100%; min-width: 0; }
  #toolbarTrailing .select-control, #toolbarTrailing .select-trigger { min-width: 0; width: 100%; }
  #toolbarTrailing .select-trigger { min-height: 44px; height: auto; }
  #toolbarTrailing .select-value { white-space: normal; }
  #toolbarSecondary { padding-top: 12px; gap: 12px 8px; }
  #toolbar[data-more="true"] #toolbarSecondary { display: flex; }
  #toolbarSecondary .filter-field { flex-basis: calc(50% - 4px); }
  /* Search keeps its full measure on tabs without the filter disclosure. */
  #toolbar:not(:has(#toolbarMore:not([hidden]))) #toolbarView { grid-column: 1 / -1; }

  .scope-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 12px; }
  .scope-strip .scope-item { min-width: 0; flex-wrap: wrap; align-content: start; gap: 4px 6px; }
  .scope-strip .scope-label { flex-basis: 100%; font-size: .75rem; }
  .scope-strip .scope-value { font-size: .875rem; }
  /* Two balanced columns on small phones; larger text naturally uses one. */
  #view .meeting-metrics { grid-template-columns: repeat(auto-fit, minmax(min(100%, max(8.5rem, (100% - 8px) / 2)), 1fr)); }
  .meeting-metric { min-height: 116px; padding: 12px; border-radius: 16px; }
  .meeting-metric .metric-label { font-size: 12px; }
  .meeting-metric .metric-previous { font-size: 12px; }
  .meeting-metric .metric-value { font-size: clamp(1.125rem, 5.3vw, 1.5rem); line-height: 1.2; }
  /* A final unpaired figure becomes a compact full-width row, never a half-empty grid. */
  #view .meeting-metric:last-child:nth-child(odd) { grid-column: 1 / -1; }
  #view .meeting-metric:last-child:nth-child(odd):not(:first-child) {
    min-height: 88px; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto;
    gap: 24px 16px; align-content: center;
  }
  #view .meeting-metric:last-child:nth-child(odd):not(:first-child) > dt { grid-column: 1; grid-row: 1; }
  #view .meeting-metric:last-child:nth-child(odd):not(:first-child) > .metric-value {
    grid-column: 2; grid-row: 1 / -1; align-self: center; margin: 0;
  }
  #view .meeting-metric:last-child:nth-child(odd):not(:first-child) > .metric-previous {
    grid-column: 1; grid-row: 2; flex-direction: row; gap: 4px 10px;
  }
  .card, .settings-panel, .panel { padding: 16px; border-radius: 18px; }
  .card-head { gap: 8px; }
}

@media (max-width: 359px) {
  .library-content { padding-inline: 12px; }
  #toolbarPeriod .popup, #toolbarPeriod .select-trigger { padding-inline: 8px; font-size: .75rem; }
  #toolbarView .segmented > button { font-size: 13px; }
  .meeting-metric { padding: 10px 8px; }
}
