/* Round 10 — fixed header timer track (1024px and up); title column width does not
   change when a timer starts. Task label stays visible at 1024–1440, truncated with
   an ellipsis; full name is in the tooltip. Narrower widths keep the existing header. */
html body{
  --d92-title:210px;
  --d92-timer:0px;
}

@media (min-width:1024px){
  html body{ --d92-title:150px; }
  @media (min-width:1100px){ html body{ --d92-title:170px; } }
  @media (min-width:1280px){ html body{ --d92-title:190px; } }
  @media (min-width:1440px){ html body{ --d92-title:210px; } }

  html body:not([data-solar-view="calendar"]):has(#timerRibbon:not([hidden])){ --d92-timer:216px; }
  @media (min-width:1100px){
    html body:not([data-solar-view="calendar"]):has(#timerRibbon:not([hidden])){ --d92-timer:220px; }
  }
  @media (min-width:1280px){
    html body:not([data-solar-view="calendar"]):has(#timerRibbon:not([hidden])){ --d92-timer:236px; }
  }
  @media (min-width:1440px){
    html body:not([data-solar-view="calendar"]):has(#timerRibbon:not([hidden])){ --d92-timer:268px; }
  }

  /* Same 4-col (or 5-col with #galaxyReturn) grid with or without a running timer.
     Column 3 is the reserved timer track: 0px when idle, fixed width when running. */
  html body #app>main>header,
  html body.d87-docked #app>main>header,
  html body:not([data-solar-view="calendar"]) #app>main>header:has(#galaxyReturn),
  html body:not([data-solar-view="calendar"]):has(#timerRibbon:not([hidden])) #app header,
  html body:not([data-solar-view="calendar"]):has(#timerRibbon:not([hidden])):has(#galaxyReturn) #app header,
  html body.d87-docked:not(.d87-x):not([data-d87-x]) #app>main>header,
  html body.d87-docked:not(.d87-x):not([data-d87-x]) #app>main>header:has(#galaxyReturn){
    display:grid!important;
    grid-template-columns:var(--d92-title) minmax(0,1fr) var(--d92-timer) auto!important;
    align-items:center!important;
    column-gap:12px!important;
  }
  html body:not([data-solar-view="calendar"]) #app>main>header:has(#galaxyReturn),
  html body:not([data-solar-view="calendar"]):has(#timerRibbon:not([hidden])):has(#galaxyReturn) #app header,
  html body.d87-docked:not(.d87-x):not([data-d87-x]) #app>main>header:has(#galaxyReturn){
    grid-template-columns:var(--d92-title) auto minmax(0,1fr) var(--d92-timer) auto!important;
  }

  html body #app>main>header>div:first-child,
  html body:not([data-solar-view="calendar"]):has(#timerRibbon:not([hidden])) #app header>div:first-child,
  html body:not([data-solar-view="calendar"]) #app header:has(#galaxyReturn)>div:first-child{
    grid-column:1!important;
    width:auto!important;
    min-width:0!important;
    max-width:100%!important;
    flex:none!important;
  }
  html body:not([data-solar-view="calendar"]) #app>main>header:has(#galaxyReturn) #galaxyReturn{
    grid-column:2!important;
  }
  html body #app>main>header .search-wrap,
  html body:not([data-solar-view="calendar"]):has(#timerRibbon:not([hidden])) #app header .search-wrap,
  html body:not([data-solar-view="calendar"]) #app header:has(#galaxyReturn) .search-wrap,
  html body:not([data-solar-view="calendar"]):has(#timerRibbon:not([hidden])):has(#galaxyReturn) #app header .search-wrap{
    grid-column:2!important;
    min-width:0!important;
    width:100%!important;
    max-width:none!important;
    justify-self:stretch!important;
  }
  html body:not([data-solar-view="calendar"]) #app>main>header:has(#galaxyReturn) .search-wrap,
  html body:not([data-solar-view="calendar"]):has(#timerRibbon:not([hidden])):has(#galaxyReturn) #app header .search-wrap{
    grid-column:3!important;
  }
  html body #app>main>header #timerSlot,
  html body #app>main>header #timerRibbon,
  html body:not([data-solar-view="calendar"]):has(#timerRibbon:not([hidden])) #app header #timerRibbon{
    grid-column:3!important;
    justify-self:end!important;
    box-sizing:border-box!important;
    min-width:0!important;
    max-width:100%!important;
  }
  html body:not([data-solar-view="calendar"]) #app>main>header:has(#galaxyReturn) #timerSlot,
  html body:not([data-solar-view="calendar"]) #app>main>header:has(#galaxyReturn) #timerRibbon,
  html body:not([data-solar-view="calendar"]):has(#timerRibbon:not([hidden])):has(#galaxyReturn) #app header #timerRibbon{
    grid-column:4!important;
  }
  html body #app>main>header #timerRibbon:not([hidden]){
    width:100%!important;
    justify-content:flex-end!important;
    overflow:hidden!important;
  }
  html body #app>main>header .header-actions,
  html body:not([data-solar-view="calendar"]):has(#timerRibbon:not([hidden])) #app header .header-actions,
  html body:not([data-solar-view="calendar"]) #app header:has(#galaxyReturn) .header-actions,
  html body:not([data-solar-view="calendar"]):has(#timerRibbon:not([hidden])):has(#galaxyReturn) #app header .header-actions{
    grid-column:4!important;
    justify-self:end!important;
    flex-wrap:nowrap!important;
  }
  html body:not([data-solar-view="calendar"]) #app>main>header:has(#galaxyReturn) .header-actions,
  html body:not([data-solar-view="calendar"]):has(#timerRibbon:not([hidden])):has(#galaxyReturn) #app header .header-actions{
    grid-column:5!important;
  }

  /* Label visible at 1024–1440; truncate with ellipsis (overrides 90-fixes hide <1440). */
  html body #app>main>header #timerRibbon .timer-ribbon-label,
  html body #app>main>header #timerSlot #timerRibbon .timer-ribbon-label{
    display:inline-block!important;
    min-width:56px!important;
    max-width:80px!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
    vertical-align:middle!important;
  }
  @media (min-width:1100px){
    html body #app>main>header #timerRibbon .timer-ribbon-label,
    html body #app>main>header #timerSlot #timerRibbon .timer-ribbon-label{max-width:80px!important}
  }
  @media (min-width:1280px){
    html body #app>main>header #timerRibbon .timer-ribbon-label,
    html body #app>main>header #timerSlot #timerRibbon .timer-ribbon-label{max-width:96px!important}
  }
  @media (min-width:1440px){
    html body #app>main>header #timerRibbon .timer-ribbon-label,
    html body #app>main>header #timerSlot #timerRibbon .timer-ribbon-label{max-width:128px!important}
  }

  @media (min-width:1280px){
    html body.d87-docked:not(.d87-x):not([data-d87-x]) #app>main>header{padding-left:28px!important}
  }
}

/* Slot is only a marker; it must not be a flex/grid item (a 0×0 box still
   occupies a grid cell and pushes #timerRibbon onto a second row). */
html body #app>main>header #timerSlot{
  display:none!important;
}

/* Keep header chrome on a single row when the 1024+ grid is active. */
@media (min-width:1024px){
  html body #app>main>header>div:first-child,
  html body #app>main>header #galaxyReturn,
  html body #app>main>header .search-wrap,
  html body #app>main>header #timerRibbon,
  html body #app>main>header .header-actions{
    grid-row:1!important;
  }
}
