/* 2Day.news V17.6 — approved source-manager, scroll and read-state refinements.
   Loaded LAST; previous V17.2 scrolling hotfix and approved branding are intact. */

/* DESKTOP: do not let a tall source list enlarge its viewport-height parent.
   Header, actions and refresh are outside the independent nav scroller. */
@media (min-width:901px) {
  html[data-device-category="desktop"] body.design-preview.stage2.headerless-concept .dashboard:not(.hidden) {
    grid-template-rows:min-content!important;
    align-items:start!important;
    min-height:0!important;
    height:auto!important;
  }
  html[data-device-category="desktop"] body.headerless-concept #desktopSourceSidebar {
    position:sticky!important;
    top:0!important;
    /* Clear legacy row-span:30, which generated 29 implicit empty grid rows. */
    grid-row:auto!important;
    height:calc(100dvh - 37px)!important;
    min-height:0!important;
    max-height:calc(100dvh - 37px)!important;
    overflow:hidden!important;
    box-sizing:border-box!important;
    display:flex!important;
    flex-direction:column!important;
    align-self:start!important;
  }
  html[data-device-category="desktop"] body.headerless-concept #desktopSourceSidebar .sidebar-fixed-brand,
  html[data-device-category="desktop"] body.headerless-concept #desktopSourceSidebar .sidebar-quick-actions,
  html[data-device-category="desktop"] body.headerless-concept #desktopSourceSidebar .sidebar-refresh-section {
    flex-shrink:0!important;
  }
  html[data-device-category="desktop"] body.headerless-concept #desktopSourceSidebar .desktop-sidebar-nav {
    flex:1 1 auto!important;
    min-height:0!important;
    max-height:none!important;
    height:auto!important;
    overflow-y:auto!important;
    overscroll-behavior-y:contain!important;
  }
  html[data-device-category="desktop"] body.headerless-concept #desktopNewsContainer:not(.hidden) {
    align-self:start!important;
    min-height:0!important;
    height:auto!important;
    padding-bottom:12px!important;
  }
}
@media (min-width:901px) and (max-width:960px) {
  html[data-device-category="desktop"] body.headerless-concept #desktopSourceSidebar {
    height:calc(100dvh - 26px)!important;
    max-height:calc(100dvh - 26px)!important;
  }
}
@media (max-width:900px) {
  html[data-device-category="mobile"] body.headerless-concept #desktopSourceSidebar {
    height:100dvh!important;max-height:100dvh!important;min-height:0!important;
    overflow:hidden!important;display:flex!important;flex-direction:column!important;
  }
  html[data-device-category="mobile"] body.headerless-concept #desktopSourceSidebar .desktop-sidebar-nav {
    flex:1 1 auto!important;min-height:0!important;overflow-y:auto!important;
    overscroll-behavior-y:contain!important;
  }
}

/* White, full-opacity utility glyphs in dark mode, including mobile drawer. */
html.theme-dark body.headerless-concept #sidebarUnifiedAddBtn,
html.theme-dark body.headerless-concept #desktopSidebarManage,
html.theme-dark body.headerless-concept #desktopSidebarSettings,
html.theme-dark body.headerless-concept #sidebarUnifiedAddBtn svg,
html.theme-dark body.headerless-concept #desktopSidebarManage svg,
html.theme-dark body.headerless-concept #desktopSidebarSettings svg {
  color:#F6F9FF!important;
  stroke:#F6F9FF!important;
  opacity:1!important;
  filter:none!important;
}

/* SOURCE MANAGER and SETTINGS: fixed-size drawer, fixed header, scrollable body. */
body.headerless-concept #d2SourceManagerPanel {
  display:flex!important;flex-direction:column!important;
  top:0!important;bottom:0!important;
  height:100dvh!important;max-height:100dvh!important;min-height:0!important;
  box-sizing:border-box!important;overflow:hidden!important;
  padding-top:max(12px,env(safe-area-inset-top))!important;
  padding-bottom:max(12px,env(safe-area-inset-bottom))!important;
}
body.headerless-concept #d2SourceManagerPanel.hidden {display:none!important}
body.headerless-concept #d2SourceManagerPanel .d2-manager-titlebar {
  flex:0 0 auto!important;position:relative!important;z-index:1!important;
  margin-bottom:0!important;padding-bottom:13px!important;
}
body.headerless-concept #d2SourceManagerPanel .custom-source-settings-row {
  flex:1 1 auto!important;min-height:0!important;
  overflow-y:auto!important;overflow-x:hidden!important;
  overscroll-behavior-y:contain!important;
  padding:12px 2px 20px 0!important;
  scrollbar-width:thin;
}
/* Close X is red in both managers on both devices/themes. */
body.headerless-concept #d2SourceManagerClose,
body.headerless-concept #settingsCloseBtn,
html.theme-dark body.headerless-concept #d2SourceManagerClose,
html.theme-dark body.headerless-concept #settingsCloseBtn {
  color:#C52935!important;-webkit-text-fill-color:#C52935!important;
  opacity:1!important;background:transparent!important;box-shadow:none!important;
}
body.headerless-concept #d2SourceManagerClose:hover,
body.headerless-concept #settingsCloseBtn:hover {color:#A50F1D!important}

/* Source name input: simple, directly editable, with clear saving/error state. */
body.headerless-concept #d2SourceManagerPanel .custom-source-name-input,
body.headerless-concept .mobile-source-name-input {
  box-sizing:border-box!important;border-radius:8px!important;
  min-width:0!important;max-width:100%!important;
  font:inherit!important;font-size:15px!important;font-weight:650!important;
}
body.headerless-concept #d2SourceManagerPanel .custom-source-name-input {
  flex:1 1 auto!important;width:100%!important;
}
body.headerless-concept #d2SourceManagerPanel .custom-source-setting-name-line {min-width:0!important;}
body.headerless-concept #d2SourceManagerPanel .custom-source-setting-main {min-width:0!important;}
body.headerless-concept #d2SourceManagerPanel .custom-source-name-input[aria-invalid="true"],
body.headerless-concept .mobile-source-name-input[aria-invalid="true"] {border-color:#D02B39!important;outline:1px solid #D02B39!important;}
body.headerless-concept .mobile-source-name-input {width:100%!important;max-width:100%!important;padding:6px 7px!important;}
body.headerless-concept .mobile-source-name-line {flex:1 1 auto!important;min-width:0!important;}
/* Previously the default badge looked like a stray button. It is now plain secondary text. */
body.headerless-concept #d2SourceManagerPanel .desktop-default-badge {
  display:inline!important;padding:0 0 0 3px!important;
  border:0!important;border-radius:0!important;background:transparent!important;
  box-shadow:none!important;font-weight:650!important;color:#66798E!important;
  font-size:11px!important;
}
html.theme-dark body.headerless-concept #d2SourceManagerPanel .desktop-default-badge{color:#ABC0D8!important;}

/* Bare up/down arrows (large invisible tap targets, visible keyboard focus). */
body.headerless-concept #d2SourceManagerPanel .custom-source-move,
body.headerless-concept .mobile-source-up,
body.headerless-concept .mobile-source-down {
  background:transparent!important;background-image:none!important;
  border:0!important;border-radius:0!important;box-shadow:none!important;
  color:inherit!important;font-size:18px!important;font-weight:650!important;
  min-width:28px!important;min-height:28px!important;
}
body.headerless-concept #d2SourceManagerPanel .custom-source-move:focus-visible,
body.headerless-concept .mobile-source-up:focus-visible,
body.headerless-concept .mobile-source-down:focus-visible{outline:2px solid #5F96CE!important;outline-offset:1px!important;}
/* Red icon-only delete, with existing explicit confirmation dialog. */
body.headerless-concept #d2SourceManagerPanel .custom-source-remove,
body.headerless-concept .mobile-source-remove {
  display:inline-flex!important;align-items:center!important;justify-content:center!important;
  color:#C72D39!important;background:transparent!important;border:0!important;
  border-radius:7px!important;box-shadow:none!important;
  width:32px!important;min-width:32px!important;height:34px!important;padding:4px!important;
}
body.headerless-concept .custom-source-remove svg,
body.headerless-concept .mobile-source-remove svg{width:19px!important;height:19px!important;display:block!important;stroke:currentColor!important;}
body.headerless-concept #d2SourceManagerPanel .custom-source-row-status {font-size:11px!important;color:#526A85!important;}

/* Unread count badges: match the parent Telex badge in publishers and child feeds. */
html body.headerless-concept .desktop-sidebar-unread-count,
html body.headerless-concept .desktop-source-unread-count,
html[data-device-category="desktop"] body.headerless-concept .desktop-publisher-heading .desktop-source-unread-count,
html[data-device-category="desktop"] body.headerless-concept .desktop-sidebar-source .desktop-sidebar-unread-count,
html[data-device-category="desktop"] body.headerless-concept .desktop-sidebar-source .desktop-source-unread-count,
html[data-device-category="mobile"] body.headerless-concept .desktop-sidebar-source .desktop-sidebar-unread-count,
html[data-device-category="mobile"] body.headerless-concept .desktop-publisher-heading .desktop-sidebar-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;
}

/* QF19: take the selected device's stored preference, not fixed V12/V13 sizes.
   Standard remains the approved 15/13 desktop and 20/20 mobile scale. */
html[data-device-category="desktop"] body[data-text-size="small"]{--d2-title-size:13px;--d2-description-size:12px;}
html[data-device-category="desktop"] body[data-text-size="standard"]{--d2-title-size:15px;--d2-description-size:13px;}
html[data-device-category="desktop"] body[data-text-size="large"]{--d2-title-size:18px;--d2-description-size:16px;}
html[data-device-category="desktop"] body.design-preview.stage2.headerless-concept #desktopNewsContainer .desktop-news-card-wrapper .story-title-trigger,
html[data-device-category="desktop"] body.design-preview.stage2.headerless-concept #desktopNewsContainer .desktop-news-card-wrapper .story-title-mobile-text {
  font-size:var(--d2-title-size,15px)!important;
}
html[data-device-category="desktop"] body.design-preview.stage2.headerless-concept #desktopNewsContainer .desktop-news-card-wrapper .story-desc-text {
  font-size:var(--d2-description-size,13px)!important;
}
html[data-device-category="mobile"] body.headerless-concept #newsBody .news-row .story-title-trigger,
html[data-device-category="mobile"] body.headerless-concept #newsBody .news-row .story-title-mobile-text,
html[data-device-category="mobile"] body.headerless-concept #newsBody .news-row .story-desc-text {
  font-size:var(--mobile-body-size,20px)!important;
}

/* QF30/UI14: a read card always has a distinct surface and a legible muted
   regular-weight headline, regardless of selected/collapsed or day group. */
html:not(.theme-dark) body.headerless-concept #desktopNewsContainer .desktop-news-card-wrapper[data-read="read"],
html:not(.theme-dark) body.headerless-concept #desktopNewsContainer .desktop-news-card-wrapper[data-read="read"] > .story-card-cell,
html:not(.theme-dark) body.headerless-concept #desktopNewsContainer .desktop-news-card-wrapper[data-read="read"] .story-card,
html:not(.theme-dark) body.headerless-concept #newsBody .news-row[data-read="read"] > .story-card-cell,
html:not(.theme-dark) body.headerless-concept #newsBody .news-row[data-read="read"] .story-card {
  background:#EDF2FB!important;
}
html.theme-dark body.headerless-concept #desktopNewsContainer .desktop-news-card-wrapper[data-read="read"],
html.theme-dark body.headerless-concept #desktopNewsContainer .desktop-news-card-wrapper[data-read="read"] > .story-card-cell,
html.theme-dark body.headerless-concept #desktopNewsContainer .desktop-news-card-wrapper[data-read="read"] .story-card,
html.theme-dark body.headerless-concept #newsBody .news-row[data-read="read"] > .story-card-cell,
html.theme-dark body.headerless-concept #newsBody .news-row[data-read="read"] .story-card {
  background:#1C2B3E!important;
}
html:not(.theme-dark) body.design-preview.stage2.light-mode-v1.headerless-concept #desktopNewsContainer .desktop-news-card-wrapper[data-read="read"] .story-title-trigger,
html:not(.theme-dark) body.headerless-concept #newsBody .news-row[data-read="read"] .story-title-trigger,
html:not(.theme-dark) body.headerless-concept #newsBody .news-row[data-read="read"] .story-title-mobile-text {
  font-weight:400!important;color:#60738A!important;-webkit-text-fill-color:#60738A!important;
}
html.theme-dark body.design-preview.stage2.headerless-concept #desktopNewsContainer .desktop-news-card-wrapper[data-read="read"] .story-title-trigger,
html.theme-dark body.headerless-concept #newsBody .news-row[data-read="read"] .story-title-trigger,
html.theme-dark body.headerless-concept #newsBody .news-row[data-read="read"] .story-title-mobile-text {
  font-weight:400!important;color:#AABED4!important;-webkit-text-fill-color:#AABED4!important;
}
/* Do not change the approved selected-card accent, title sizes, thumbnail, or metadata. */
/* Win over legacy .stage2 and .light-mode-v1 background shorthand overrides. */
html:not(.theme-dark)[data-device-category="desktop"] body.design-preview.stage2.light-mode-v1.headerless-concept
#desktopNewsContainer .desktop-news-card-wrapper[data-read="read"],
html:not(.theme-dark)[data-device-category="desktop"] body.design-preview.stage2.light-mode-v1.headerless-concept
#desktopNewsContainer .desktop-news-card-wrapper[data-read="read"] > .story-card-cell,
html:not(.theme-dark)[data-device-category="desktop"] body.design-preview.stage2.light-mode-v1.headerless-concept
#desktopNewsContainer .desktop-news-card-wrapper[data-read="read"] .story-card {
  background:#EDF2FB!important;background-image:none!important;
}
html.theme-dark[data-device-category="desktop"] body.design-preview.stage2.headerless-concept
#desktopNewsContainer .desktop-news-card-wrapper[data-read="read"],
html.theme-dark[data-device-category="desktop"] body.design-preview.stage2.headerless-concept
#desktopNewsContainer .desktop-news-card-wrapper[data-read="read"] > .story-card-cell,
html.theme-dark[data-device-category="desktop"] body.design-preview.stage2.headerless-concept
#desktopNewsContainer .desktop-news-card-wrapper[data-read="read"] .story-card {
  background:#1C2B3E!important;background-image:none!important;
}
