/* 2Day Phase 1 visual consistency: use approved existing design tokens only. */

/* Restore a proper title grid item. V16.2's display:contents and inline anchor
   intentionally allowed wrapping below media; user has superseded that rule. */
@media (max-width: 900px) {
  html[data-device-category="mobile"] body.headerless-concept #newsBody .news-row .story-title-cell,
  html[data-device-category="mobile"] body.headerless-concept #newsBody .news-row .story-title-wrap {
    display: block !important;
    min-width: 0 !important;
  }
  html[data-device-category="mobile"] body.headerless-concept #newsBody .news-row .story-title-trigger {
    display: block !important;
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
  }
}

/* Extended audit sweep: existing brand/layout retained. The following are
   verified in the real audit or correct a measurable overflow risk in the
   same controls. No change to nominal typography, colors or source behavior. */

/* UI19: align the mobile drawer's 15px/17px unread-count glyph to the already
   approved Telex 12px count standard; keep existing background and spacing. */
html[data-device-category="mobile"] body.headerless-concept #desktopSourceSidebar .desktop-sidebar-unread-count,
html[data-device-category="mobile"] body.headerless-concept #desktopSourceSidebar .desktop-source-unread-count,
html[data-device-category="mobile"] body.headerless-concept #desktopSourceSidebar .desktop-publisher-heading .desktop-source-unread-count {
  font-family: 'Nunito Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  font-size: 12px !important;
  font-weight: 850 !important;
  line-height: 14px !important;
  font-variant-numeric: tabular-nums !important;
  letter-spacing: 0 !important;
}

/* R21/QF24: preserve the existing form controls but prevent text and labels
   from being clipped at narrow width or with long account/source data. */
body.headerless-concept #settingsPanel .v10-settings-section,
body.headerless-concept #settingsPanel .settings-row,
body.headerless-concept #settingsPanel .v10-account-details,
body.headerless-concept #d2SourceManagerPanel .custom-source-setting-main {
  min-width: 0 !important;
}
body.headerless-concept #settingsPanel #accountEmail,
body.headerless-concept #d2SourceManagerPanel .custom-source-url {
  max-width: 100% !important;
  overflow-wrap: anywhere !important;
}
body.headerless-concept #d2SourceManagerPanel .custom-source-url {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

/* UI20: existing buttons' focus feedback must remain visible in both themes
   without recoloring their normal/selected appearance or changing hitboxes. */
body.headerless-concept #settingsPanel .text-size-choice:focus-visible,
body.headerless-concept #settingsPanel .v10-segment-choice:focus-visible,
body.headerless-concept #settingsPanel .v10-setting-select:focus-visible,
body.headerless-concept #d2SourceManagerPanel .custom-source-name-input:focus-visible,
body.headerless-concept #d2SourceManagerPanel .custom-source-move:focus-visible,
body.headerless-concept #d2SourceManagerPanel .custom-source-remove:focus-visible,
body.headerless-concept #desktopSourceSidebar .desktop-sidebar-source:focus-visible {
  outline: 2px solid #315EDB !important;
  outline-offset: 2px !important;
}

/* AI presentation (Phase 1 defect-only): never cut long generated links,
   question text or numbered-summary prose; leave all AI actions and type sizes. */
body.headerless-concept .analysis-row .analysis-panel .history-answer,
body.headerless-concept .analysis-row .analysis-panel .ai-number-list li,
body.headerless-concept .analysis-row .analysis-panel .ask-answer-body,
body.headerless-concept .desktop-analysis-host .analysis-panel .history-answer,
body.headerless-concept .desktop-analysis-host .analysis-panel .ai-number-list li,
body.headerless-concept .desktop-analysis-host .analysis-panel .ask-answer-body {
  min-width: 0 !important;
  overflow-wrap: anywhere !important;
}

@media (max-width: 900px) {
  /* QF24: remove unnecessarily centered/indented delete action; align it
     with the source-details column, preserving a full-width status message,
     the 32x34 delete target, reorder arrows and save confirmation. */
  html[data-device-category="mobile"] body.headerless-concept #d2SourceManagerPanel .custom-source-setting-item {
    grid-template-columns: 28px minmax(0, 1fr) !important;
    column-gap: 7px !important;
    align-items: start !important;
  }
  html[data-device-category="mobile"] body.headerless-concept #d2SourceManagerPanel .custom-source-order-actions {
    grid-column: 1 !important;
    grid-row: 1 !important;
    align-self: center !important;
  }
  html[data-device-category="mobile"] body.headerless-concept #d2SourceManagerPanel .custom-source-setting-main {
    grid-column: 2 !important;
    grid-row: 1 !important;
    width: 100% !important;
  }
  html[data-device-category="mobile"] body.headerless-concept #d2SourceManagerPanel .custom-source-setting-actions {
    grid-column: 2 !important;
    grid-row: 2 !important;
    display: flex !important;
    align-self: start !important;
    justify-self: stretch !important;
    justify-content: space-between !important;
    width: 100% !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    flex-wrap: nowrap !important;
  }
  html[data-device-category="mobile"] body.headerless-concept #d2SourceManagerPanel .custom-source-row-status {
    min-width: 0 !important;
    max-width: calc(100% - 38px) !important;
    white-space: normal !important;
  }

  /* Account and long selected-source names can wrap without pushing panel
     controls outside their current boundaries. */
  html[data-device-category="mobile"] body.headerless-concept #settingsPanel .v10-setting-select,
  html[data-device-category="mobile"] body.headerless-concept #settingsPanel #defaultSourceSelect,
  html[data-device-category="mobile"] body.headerless-concept #d2SourceManagerPanel .custom-source-name-input {
    box-sizing: border-box !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
  html[data-device-category="mobile"] body.headerless-concept #desktopSourceSidebar .desktop-publisher-name,
  html[data-device-category="mobile"] body.headerless-concept #desktopSourceSidebar .desktop-sidebar-source-name {
    min-width: 0 !important;
    overflow-wrap: anywhere !important;
  }
}

/* AI result overflow guard applies to both newly rendered and existing cached
   results, regardless of whether they are in the desktop or mobile panel.
   This does not change fonts, list numbering, margins, or AI behavior. */
body.headerless-concept .analysis-history,
body.headerless-concept .analysis-result,
body.headerless-concept .history-card,
body.headerless-concept .history-answer,
body.headerless-concept .ask-question-text,
body.headerless-concept .ai-number-list,
body.headerless-concept .ai-bullet-list,
body.headerless-concept .history-sources {
  min-width: 0 !important;
  overflow-wrap: anywhere !important;
}
