/* today.txt */
.tt { gap: 12px; container: tt / inline-size; }

/* tabs */
.tt-tabs { display: flex; border-bottom: var(--b); margin: -14px -18px 0; }
.tt-tabs button[role="tab"] {
  flex: 0 0 auto; border: none; border-right: var(--b); background: transparent; padding: 7px 16px;
  font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px;
}
.tt-tabs button[role="tab"]:hover { background: var(--hover); }
.tt-tabs button[aria-selected="true"] { background: var(--accent-2); }
.tt-tabs { align-items: stretch; }
.tt-tools { margin-left: auto; display: flex; align-items: center; gap: 2px; padding: 2px 6px; }
.tt-badge:empty { display: none; }
.tt-badge { border: var(--b); background: var(--field); font-size: 11px; padding: 0 5px; line-height: 16px; }
.tt-panel { display: flex; flex-direction: column; gap: 12px; }
.tt-panel[hidden] { display: none; }

/* meter */
.tt-meter { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; align-items: center; border: var(--b); background: var(--field); padding: 10px 12px; }
.tt-pct { grid-row: span 2; font-family: var(--display); font-weight: 800; font-size: 40px; line-height: 1; font-variant-numeric: tabular-nums; min-width: 3.1ch; }
.tt-msg { font-weight: 700; font-size: 14px; }
.tt-meter .pill { height: 20px; border: var(--b); padding: 2px; background: var(--surface); }
.tt-meter .pill div { height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--ink) 0 12px, transparent 12px 15px); transition: width .35s steps(12); }

/* add box */
.tt-add { display: flex; gap: 8px; }
.tt-add input { flex: 1; min-width: 0; height: 40px; border: var(--b); background: var(--field); padding: 0 12px; font-size: 15px; }
.tt-add input:focus-visible { outline: 2px dashed var(--ink); outline-offset: 2px; }
.tt-add .btn { height: 40px; padding: 0 16px; font-size: 14px; }

.tt-win { margin: 0; border: var(--b); background: var(--green); padding: 8px 12px; font-weight: 700; text-align: center; }

/* list */
.tt-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.tt-task { border-bottom: 2px solid var(--rule); padding: 6px 0; }
.tt-task:last-child { border-bottom: none; }
.tt-task.pop { animation: tt-pop .35s ease-out; }
@keyframes tt-pop { from { background: var(--accent-2); } to { background: transparent; } }
.tt-row, .tt-sub, .tt-thought { display: flex; align-items: center; gap: 10px; min-width: 0; }

.tt-check {
  appearance: none; -webkit-appearance: none; margin: 0; flex: 0 0 26px; width: 26px; height: 26px;
  border: var(--b); background: var(--field); cursor: pointer; display: grid; place-items: center;
}
.tt-check::after { content: ""; width: 7px; height: 13px; border: solid var(--ink); border-width: 0 3px 3px 0; transform: rotate(45deg) scale(0); margin-top: -3px; transition: transform .12s; }
.tt-check:checked { background: var(--accent-2); }
.tt-check:checked::after { transform: rotate(45deg) scale(1); }
.tt-check.sm { flex-basis: 18px; width: 18px; height: 18px; }
.tt-check.sm::after { width: 5px; height: 9px; border-width: 0 2px 2px 0; margin-top: -2px; }

.tt-name {
  flex: 1; min-width: 0; text-align: left; border: none; background: none; padding: 2px 4px;
  font-weight: 700; font-size: 15px; overflow-wrap: anywhere; cursor: text;
}
.tt-name:hover { background: var(--hover); }
.tt-sub .tt-name { font-weight: 400; font-size: 14px; }
.done > .tt-row .tt-name, .tt-sub.done .tt-name { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--mute); }
.tt-rename { flex: 1; min-width: 0; border: var(--b); background: var(--field); padding: 2px 6px; font-weight: 700; font-size: 15px; }

.tt-count { flex: none; cursor: default; color: inherit; border: var(--b); background: var(--field); font-size: 11px; font-weight: 700; padding: 0 6px; line-height: 18px; font-variant-numeric: tabular-nums; }
.tt-icon { flex: none; width: 26px; height: 26px; padding: 0; border: var(--line) solid transparent; background: none; color: var(--mute); display: grid; place-items: center; }
.tt-icon:hover, .tt-icon[aria-expanded="true"] { border-color: var(--outline); color: var(--ink); background: var(--field); }
.tt-icon.sm { width: 22px; height: 22px; }

.tt-subs { list-style: none; margin: 4px 0 0; padding: 0 0 0 36px; display: flex; flex-direction: column; gap: 2px; }
.tt-subadd input { width: 100%; border: none; border-bottom: 2px dashed var(--rule); background: transparent; padding: 5px 2px; font-size: 14px; outline: none; }
.tt-subadd input:focus { border-bottom-color: var(--outline); }

.tt-thought { border-bottom: 2px solid var(--rule); padding: 6px 0; }
.tt-thought:last-child { border-bottom: none; }
.tt-thought .tt-name { font-weight: 400; }

.tt-empty { list-style: none; text-align: center; padding: 20px 10px; border: 2px dashed var(--rule); color: var(--mute); font-size: 14px; }
.tt-empty b { display: block; font-family: var(--display); font-size: 22px; color: var(--ink); }

.tt-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; color: var(--mute); border-top: var(--b); padding-top: 10px; }
.tt-ghost { border: var(--line) dashed var(--outline); background: transparent; color: var(--ink); padding: 3px 10px; font-size: 13px; font-weight: 700; }
.tt-ghost:hover:not(:disabled) { border-style: solid; background: var(--hover); }
.tt-ghost:disabled { opacity: .4; cursor: default; }
.tt-move { flex: none; padding: 2px 8px; font-size: 12px; }

/* things that only exist in compact view */
.tt-donemore, .tt-allclear { display: none; }
.tt:not(.compact) [data-tool="add"] { display: none; }

/* ===== compact view: just what's left to do ===== */
.tt.compact { gap: 8px; }
.tt.compact .tt-tabs button[role="tab"] { padding: 4px 12px; font-size: 13px; }
.tt.compact .tt-meter { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.tt.compact .tt-pct { font-size: 17px; min-width: 0; }
.tt.compact .tt-msg { display: none; }
.tt.compact .tt-meter .pill { flex: 1; height: 14px; padding: 1px; }
.tt.compact .tt-add { display: none; }
.tt.compact.adding .tt-add { display: flex; }
.tt.compact.adding [data-tool="add"] { border-color: var(--outline); background: var(--field); color: var(--ink); }
.tt.compact .tt-task.done { display: none; }
.tt.compact .tt-subs { display: none; }
.tt.compact .tt-task.expanded .tt-subs { display: flex; }
.tt.compact .tt-count { cursor: pointer; }
.tt.compact .tt-count:hover, .tt.compact .tt-count[aria-expanded="true"] { background: var(--accent-2); }
.tt.compact .tt-win, .tt.compact .tt-foot { display: none; }
.tt.compact .tt-task { padding: 4px 0; }
.tt.compact .tt-donemore:not([hidden]) {
  display: block; align-self: flex-start; border: none; background: none; padding: 2px 0;
  font-size: 12px; color: var(--mute); text-decoration: underline; text-underline-offset: 3px;
}
.tt.compact .tt-donemore:hover { color: var(--ink); }
.tt.compact .tt-allclear { display: block; padding: 12px; }
.tt.compact .tt-allclear b { font-size: 18px; }
.tt.compact .tt-empty:not(.tt-allclear) { padding: 12px; }

/* fit to 3: only on the floating desk, in compact view, when the window wasn't resized by hand */
.desk.floating .win:not(.sized):not(.max) .tt.compact .tt-list { max-height: var(--tt-max, none); overflow-y: auto; overscroll-behavior: contain; }

/* ===== resized small: trim to checkboxes + names ===== */
@container tt (max-width: 300px) {
  .tt-meter, .tt-msg, .tt-count, .tt-badge { display: none !important; }
  .tt-row .tt-icon, .tt-thought .tt-icon, .tt-thought .tt-move, .tt-sub .tt-icon { opacity: 0; }
  .tt-row:hover .tt-icon, .tt-row:focus-within .tt-icon,
  .tt-thought:hover :is(.tt-icon, .tt-move), .tt-thought:focus-within :is(.tt-icon, .tt-move),
  .tt-sub:hover .tt-icon, .tt-sub:focus-within .tt-icon { opacity: 1; }
  .tt-tabs button[role="tab"] { padding: 4px 8px; }
  .tt-name { font-size: 14px; }
}

/* celebration sparks (square, retro) */
.tt-spark {
  position: fixed; z-index: 70; width: 9px; height: 9px; border: 2px solid var(--outline); pointer-events: none;
  animation: tt-spark .75s cubic-bezier(.2, .7, .3, 1) forwards;
}
@keyframes tt-spark {
  from { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.4) rotate(90deg); opacity: 0; }
}

@media (max-width: 860px) {
  .tt-subs { padding-left: 14px; }
  .tt-pct { font-size: 32px; }
  /* bigger tap targets for thumbs */
  .tt-icon { width: 34px; height: 34px; }
  .tt-icon.sm { width: 30px; height: 30px; }
  .tt-check { flex-basis: 30px; width: 30px; height: 30px; }
  .tt-check.sm { flex-basis: 24px; width: 24px; height: 24px; }
}

/* a task sent from a project on the board (docs/features/projects.md) */
.tt-link { flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; border: 1.5px solid var(--outline); background: var(--orange-2); padding: 0 5px; align-self: center; }
