/* ==========================================================================
   Someday lists — tabs toolbar and list columns
   ========================================================================== */

.someday-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.3333rem;
  height: 2.2222rem;
  padding: 0 0.8889rem;
  background: var(--someday-bg);
  position: relative;
  z-index: 10;
}

.someday-list-tabs {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  gap: 0.6667rem;
}

.someday-list-tabs__tabs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  min-width: 0;
}
.someday-list-tabs__tabs::-webkit-scrollbar {
  display: none;
}

.someday-list-tabs__tab {
  display: flex;
  align-items: center;
  flex: 0 1 auto;
  min-width: 2.2778rem;
  max-width: 22.2222rem;
  height: 2rem;
  padding: 0 0.8333rem;
  border-radius: var(--radius-s);
  font-size: 0.5556rem;
  font-weight: 700;
  letter-spacing: normal; /* live tabs have no extra tracking */
  text-transform: uppercase;
  color: var(--tab-color);
  cursor: pointer;
  user-select: none;
  position: relative;
}

.someday-list-tabs__tab:hover {
  background: var(--tab-hover-bg);
}

.someday-list-tabs__tab--active {
  color: var(--tab-active-color);
  flex-shrink: 0;
  padding-inline-start: 0;
}
.someday-list-tabs__tab--active:hover {
  background: transparent;
}

@media (min-width: 48.0625em) {
  .someday-list-tabs__tab:first-child {
    margin-inline-start: 1.0556rem;
  }
  .someday-list-tabs__tab--active:first-child {
    margin-inline-start: 0.4444rem;
  }
}
/* live: the underline lives on the tab *name* and starts past the overflow
   dots (left: 1.4444rem), so it sits under the title only. */
.someday-list-tabs__tab--active .someday-list-tabs__name::before {
  content: "";
  position: absolute;
  left: 1.4444rem;
  right: 0;
  bottom: -0.1111rem;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--accent); /* live --custom-color */
}

.someday-list-tabs__name {
  align-items: center;
  display: grid;
  grid-template-columns: 1fr repeat(2, auto);
  justify-content: space-between;
  position: relative;
  width: 100%;
}

.someday-list-tabs__name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Live shows the count as a plain number in the same colour as the tab label,
   not a filled pill. */
.someday-list-tabs__number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.5556rem;
  font-weight: 700;
  color: inherit;
  margin-inline-start: 0.5556rem; /* live .someday-list-tabs__number */
}

.someday-list-tabs__actions {
  display: none;
  align-items: center;
  margin: 0.2222rem;
}
.someday-list-tabs__tab--active .someday-list-tabs__actions {
  display: inline-flex;
}
.someday-list-tabs__actions .ui-button--icon {
  width: 1rem;
  height: 1rem;
  min-width: 1rem;
}
.someday-list-tabs__actions .ui-icon {
  width: 0.8889rem;
  height: 0.8889rem;
}

.someday-list-tabs__add {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  color: #707070;
}
.someday-list-tabs__add .ui-button {
  background-color: transparent;
  color: #707070;
}
.someday-list-tabs__add .ui-button:hover,
.someday-list-tabs__add .ui-button:focus-visible {
  background-color: var(--tab-hover-bg);
  color: #707070;
}
.someday-list-tabs__add--disabled {
  opacity: 0.35;
  pointer-events: none;
}

.ui-button--someday-collapse {
  flex: 0 0 auto;
  margin-inline-start: auto;
  background: var(--app-bg);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  color: var(--someday-collapse);
  position: relative;
  z-index: 1;
}
.ui-button--someday-collapse:hover,
.ui-button--someday-collapse:focus-visible {
  background: var(--app-bg);
  color: var(--someday-collapse-hover);
}
.someday-collapse__icon--open {
  transform: rotate(180deg);
}

/* ---- Lists section ---- */
.someday-list-section {
  /* Live keeps Someday ruled rows at 34px, independent of day-grid density. */
  --todo-height: 1.8889rem;
  --todo-border-color: #edeef0; /* live .app--secondary */
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 51vh; /* live's minimum for the lists area */
  background: var(--someday-bg);
  position: relative;
}

html[theme="dark"] .someday-list-section {
  --todo-border-color: #26272a;
}

.someday-list-section--collapsed {
  display: none;
}

.someday-lists {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 1.1111rem; /* same 20px page gutter as the day grid */
  overflow-x: auto;
  overflow-y: hidden;
  /* The custom bar below sits above the footer; hide the native one. */
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.someday-lists::-webkit-scrollbar {
  display: none;
}

/* Paint the ruled layer above empty/composer rows, which otherwise mask
   individual background lines and leave holes after the first task. */
.someday-list-section .todo__body {
  margin: 0 var(--todo-outer-margin);
}
.someday-list-section .todo__body::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  /* A separately rasterized tile keeps thin rules visible at fractional zoom.
     A repeating gradient can drop entire rules between device pixels. */
  background-image: linear-gradient(to top,
    var(--todo-border-color) 0 var(--list-divider-thickness),
    transparent var(--list-divider-thickness));
  background-size: 100% var(--todo-height);
  background-repeat: repeat-y;
}
.someday-list-section .todo__body::after { display: none; }
.someday-list-section .todo__list-item {
  padding-inline-start: 0;
  padding-inline-end: 0;
}
.someday-list-section .todo__list-item .todo-content,
.someday-list-section .todo__list-item + .todo__list-item:not(.is-heading) .todo-content {
  border-top-color: transparent;
}
.someday-list-section .todo__list-item.is-editing .todo-content::after { display: none; }
html.hide-lines--true .someday-list-section .todo__body::before { display: none; }

/* Keep the track in the visible Someday area, above the fixed footer. */
.someday-scrollbar {
  position: fixed;
  inset-inline: 0;
  height: 0;
  z-index: 199;
  display: none;
}
.someday-scrollbar.is-visible {
  display: block;
}
.someday-scrollbar__track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0.2222rem; /* live SimpleBar sticky track: 4px */
  border-radius: 0;
  background: #f2f2f2;
  overflow: hidden;
  pointer-events: auto;
}
.someday-scrollbar__thumb {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  min-width: 2rem;
  border-radius: 0;
  background: #c7c7c7;
  cursor: grab;
}
.someday-scrollbar__thumb:active {
  cursor: grabbing;
}
html[theme="dark"] .someday-scrollbar__track {
  background: #26272a;
}
html[theme="dark"] .someday-scrollbar__thumb {
  background: #57585b;
}

/* Live uses the same 5-column rhythm as the week grid: four lists plus a fifth
   slot for the New List affordance. */
.grid__item--secondary {
  display: flex;
  flex: 0 0 calc(100% / var(--someday-columns, 5));
  flex-direction: column;
  width: calc(100% / var(--someday-columns, 5));
  align-self: stretch;
  height: auto;
  position: relative;
  padding-top: 0;
}

.grid__item--list-drop {
  background: var(--someday-hover);
  outline: 1px dashed var(--line-strong);
  outline-offset: -2px;
}

/* Hovering the list's move grip highlights its whole column, like live's
   drag affordance (the header-only hover would otherwise leave the body flat). */
.grid__item--secondary:has(.someday-actions__handle:hover) {
  background-color: var(--someday-hover);
}

.grid__item--is-dragging {
  opacity: 0.25;
}

/* Whole-list drag (live): the hovered list column grows to 2× and one half is
   a placeholder; which side depends on the pointer's edge. */
.grid__item--secondary.grid__item--is-dragging-over {
  display: flex;
  flex: 0 0 calc(200% / var(--someday-columns, 5));
  width: calc(200% / var(--someday-columns, 5));
  min-width: 0;
  flex-direction: row;
}
.grid__item--secondary.grid__item--is-dragging-over .grid__item-padding {
  flex: 1 1 50%;
  max-width: 50%;
}
.grid__item-placeholder {
  flex: 0 0 50%;
  width: 50%;
  align-self: stretch;
  background: var(--someday-hover);
  border-radius: var(--radius);
}
.grid__item--list-clone {
  background: var(--someday-bg);
  overflow: hidden;
}

.someday-list-tabs__tab--is-dragging-over {
  background: var(--tab-hover-bg);
  color: var(--tab-active-color);
}

.grid__item-padding {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  /* live has no overflow here: the checkbox wrapper sits outside the row's left
     edge, so `hidden` clipped it. */
}

.todo--secondary {
  display: flex;
  flex: 1 1 100%;
  flex-direction: column;
  height: 100%;
  position: relative;
  /* live `.todo` sets the shared list/header text colour */
  color: var(--todo-text);
}

.todo__header-wrapper--secondary {
  position: relative;
  flex: 0 0 auto;
  /* Clear the navigation rail (35px offset + 68px controls) before tasks. */
  height: 6rem;
  box-sizing: border-box;
  padding-bottom: 0.3333rem;
}

@media (max-width: 48em) {
  .todo__header-wrapper--secondary {
    height: 4.5rem;
  }
}

.todo__header--secondary {
  display: flex;
  align-items: center;
  min-height: 2.4444rem;
  margin-bottom: 0;
  padding-top: 0.5556rem;
  column-gap: 0.5556rem;
}

.todo__header__text--secondary {
  display: flex;
  align-items: center;
  gap: 0.3333rem;
  width: 100%;
  padding-inline-start: 1.6667rem;
  padding-inline-end: 1.1111rem;
}

/* Live floats the manage control over the heading instead of pushing it right. */
.todo__header__text--secondary > .ui-button--someday-actions {
  position: absolute;
  left: 0.4444rem;
  top: 50%;
  transform: translateY(-50%);
}

.todo__title--secondary {
  font-family: var(--ff-condensed);
  font-size: 1.3333rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.1;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--todo-text);
}

/* live: the list body does NOT scroll or clip — the checkbox wrapper sits
   outside the row's left edge, so `overflow-x: hidden` here cut the checkbox
   off. The page (and the strip) do the scrolling, as in live. */

/* Live's `.someday-actions`: an in-flow full-width strip above the list title,
   padding 3px 10px 3px 3px, hidden until the header is hovered. The grip is a
   16px drag-handle icon centred in the strip (padding-top 8px), NOT a control
   pinned to the top-left. */
.someday-actions {
  position: relative;
  display: flex;
  justify-content: space-between;
  padding: 0.1667rem 0.5556rem 0.1667rem 0.1667rem;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.25s ease-in-out;
  color: var(--todo-text); /* live .someday-actions inherits the todo text colour */
}
.todo__header-wrapper--secondary:hover .someday-actions,
.todo__header-wrapper--secondary:focus-within .someday-actions {
  opacity: 1;
}

.ui-button--someday-actions {
  color: var(--transport-color); /* live --ui-button-icon-color (#707070 both themes) */
  opacity: 0;
  transition: opacity 0.25s ease-in-out;
}
.todo__header-wrapper--secondary:hover .ui-button--someday-actions,
.todo__header-wrapper--secondary:focus-within .ui-button--someday-actions {
  opacity: 1;
}
.someday-actions__handle {
  flex: 1;
  display: flex;
  justify-content: center;
  padding-top: 0.5rem;
  cursor: grab;
  color: #707070; /* live .someday-actions__handle::after */
}
.someday-actions__handle .ui-icon {
  width: 0.8889rem;
  height: 0.8889rem;
}
.someday-actions__handle:active {
  cursor: grabbing;
}

/* New-list affordance — lives in the fifth column, aligned with the list
   headings, exactly like live (86x26, #f2f2f2 / #707070). */
.grid__item--new-list .grid__item-padding {
  padding-top: 0.5556rem;
  padding-inline-start: 1.1111rem;
}

.new-list-btn {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.2778rem;
  height: 1.4444rem;
  padding: 0 0.5556rem 0 0.3333rem;
  border-radius: var(--radius-s);
  background: var(--btn-bg); /* live .ui-button--add-list: #f2f2f2 / #2c2c2c */
  color: var(--text-muted);
  font-size: 0.5556rem;
  font-weight: 700;
  letter-spacing: 0.05em; /* live .ui-button--add-list */
  text-transform: uppercase;
  white-space: nowrap;
}
.new-list-btn .ui-icon {
  width: 0.8889rem;
  height: 0.8889rem;
}
.new-list-btn:hover {
  background: var(--btn-hover-bg);
}
html[theme="dark"] .new-list-btn {
  background: var(--btn-bg);
}
/* Reserve the actions column in every tab so activation never moves the title. */
.someday-list-tabs__actions { display:inline-flex;flex:0 0 1.7rem;margin:0;align-items:center;justify-content:center; }
.someday-list-tabs__tab--active .someday-list-tabs__actions { display:inline-flex; }
.someday-list-tabs__actions .ui-button--icon { width:1.7rem;height:1.7rem;min-width:1.7rem;display:grid;place-items:center; }
.someday-list-tabs__tab:not(.someday-list-tabs__tab--active) .someday-list-tabs__actions .ui-button { opacity:0; }
.someday-list-tabs__tab:not(.someday-list-tabs__tab--active):hover .someday-list-tabs__actions .ui-button,.someday-list-tabs__actions .ui-button:focus-visible { opacity:1; }
.someday-list-tabs__name { grid-template-columns:1.7rem minmax(0,1fr) auto;gap:0.1rem; }
.someday-list-tabs__tab,.someday-list-tabs__tab--active { padding-inline-start:0.35rem; }
.someday-list-tabs__tab--active .someday-list-tabs__name::before { left:1.8rem; }
.todo__header__text--secondary { position:relative;padding-inline-start:0.35rem; }
.todo__header__text--secondary > .ui-button--someday-actions { position:static;transform:none;flex:none;width:1.8rem;height:1.8rem;min-width:1.8rem;display:grid;place-items:center;margin:0; }
.todo__title--secondary { min-width:0; }
@media(min-width:48.0625em) {
  .someday-list-tabs__tab:first-child,
  .someday-list-tabs__tab--active:first-child { margin-inline-start:.5rem; }
}

/* Let long lists contribute their full height to document scrolling. */
.someday-lists { flex: 0 0 auto; padding-bottom: 0; align-items: stretch; }
.someday-lists .grid__item-padding, .someday-lists .todo--secondary { height: auto; min-height: 100%; }
.someday-lists .todo__body { flex: 0 0 auto; }

/* Equal-height columns share a ruled writing area, with a permanent composer. */
.someday-lists .grid__item--secondary { display: flex; align-self: stretch; }
.someday-lists .grid__item-padding { flex: 1 1 auto; min-height: 0; height: auto; width: 100%; }
.someday-lists .todo--secondary { flex: 1 1 auto; min-height: 0; height: auto; }
.someday-lists .todo__body { flex: 1 0 auto; min-height: calc(var(--todo-height) * 2); padding-bottom: var(--todo-height); }
.someday-lists .todo__list-item--composer { flex: 0 0 var(--todo-height); min-height: var(--todo-height); }
.someday-lists .todo__body::before { bottom: 0; }
/* Composer movement must not become the browser's scroll anchor. */
.someday-list-section { overflow-anchor: none; }

.someday-list-section { min-height: 0; flex: 0 0 auto; }
.someday-lists .grid__item--secondary { padding-bottom: 8px; }
/* Full-tree redraws must not let the browser select a different page anchor. */
html:has(.someday-list-section) { overflow-anchor: none; }

.someday-list-tabs__name-text:focus-visible { outline:2px solid var(--accent); outline-offset:2px; border-radius:3px; }
