/* owned by the plan screen — prefix .pl- */

/* ---------- layout ---------- */
.pl-title { margin-bottom: 4px; }
.pl-grid { display: flex; flex-direction: column; }
.pl-col { min-width: 0; }
.pl-sec { margin-top: 36px; }
.pl-col:first-child > .pl-sec:first-child { margin-top: 20px; }
/* v6: one centred column on a computer too, like Sport, in line with the tab bar */
[data-screen="plan"].screen--wide { max-width: calc(720px + 2 * var(--pad)); }
/* v6: a plan added on a day that already counts: one quiet line under today's list */
.pl-counted { margin: 0 0 10px; font-size: var(--t-small); line-height: 1.4; color: var(--muted); text-wrap: pretty; }

/* ---------- heads ---------- */
.pl-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px;
  min-height: 46px; padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
.pl-h2 { font-size: var(--t-h2); font-weight: 650; letter-spacing: -0.025em; line-height: 1.15; overflow-wrap: anywhere; hyphens: manual; }
.pl-head__end { display: flex; align-items: baseline; gap: 14px; margin-left: auto; }
.pl-meta { font-size: var(--t-small); color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* another day: one small head per date */
.pl-dayhead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 22px 0 10px; border-bottom: 1px solid var(--line); }
.pl-h3 { min-width: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.3; color: var(--muted); overflow-wrap: anywhere; }

/* "Clear": a whole day goes, with Undo. Quiet text, a real 44px target. */
.pl-clear {
  position: relative; flex: none; margin: -6px 0 -6px -8px; padding: 6px 8px; border: 0; border-radius: 8px; background: none; cursor: pointer;   /* no negative right margin: the focus ring stays inside the column */
  font: 500 var(--t-small)/1.3 var(--f-sans); letter-spacing: -0.005em; color: var(--muted);
  transition: color var(--dur-fast), opacity var(--dur-fast);
  -webkit-tap-highlight-color: transparent;
}
.pl-clear::after { content: ''; position: absolute; inset: -7px 0 -7px -2px; }
.pl-clear:active { opacity: 0.55; }
@media (hover: hover) { .pl-clear:hover { color: var(--fg); } }

/* ---------- list ---------- */
.pl-list { list-style: none; margin: 0; padding: 0; }
.pl-item, .pl-new {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 0; border-bottom: 1px solid var(--line);
}
.pl-item__text { flex: 1; min-width: 0; padding-top: 1px; }
.pl-item.is-new { animation: pl-in 260ms var(--ease-out); }
@keyframes pl-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* the text is the field: tap it to edit */
.pl-text {
  display: block; width: 100%; min-width: 0; min-height: 22px;
  padding: 0; margin: 0; border: 0; border-radius: 0; background: none; resize: none; overflow: hidden;
  font: 500 16px/1.4 var(--f-sans); letter-spacing: -0.012em; color: var(--fg);
  outline: none; overflow-wrap: anywhere; word-break: break-word; hyphens: manual;
  transition: color var(--dur) var(--ease-out);
}
.pl-text::placeholder { color: var(--faint); font-weight: 450; }
.pl-item.is-done .pl-text { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); text-decoration-thickness: 1.5px; }

/* done circle */
.pl-check {
  position: relative; flex: none; display: grid; place-items: center;
  width: 24px; height: 24px; margin-top: 0; padding: 0; border: 0; border-radius: 50%;
  background: none; color: var(--bg); cursor: pointer;
  box-shadow: inset 0 0 0 1.5px var(--line-strong);
  transition: background var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast), transform var(--dur-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.pl-check::after { content: ''; position: absolute; inset: -10px; }
.pl-check svg { width: 14px; height: 14px; opacity: 0; transform: scale(0.6); transition: opacity var(--dur-fast), transform var(--spring-bouncy-dur) var(--spring-bouncy); }
.pl-check[aria-pressed="true"] { background: var(--muted); box-shadow: none; }
.pl-check[aria-pressed="true"] svg { opacity: 1; transform: none; }
.pl-check:active { transform: scale(0.88); }
@media (hover: hover) { .pl-check:not([aria-pressed="true"]):hover { box-shadow: inset 0 0 0 1.5px var(--muted); } }

/* delete one line: always there, quiet until it is pointed at */
.pl-del {
  position: relative; flex: none; display: grid; place-items: center;
  width: 32px; height: 32px; margin: -4px 0; padding: 0; border: 0; border-radius: 50%;   /* inside the column, ring and all */
  background: none; color: var(--faint); cursor: pointer;
  transition: color var(--dur-fast), background var(--dur-fast), transform var(--dur-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.pl-del::after { content: ''; position: absolute; inset: -6px 0 -6px -4px; }
.pl-del svg { width: 17px; height: 17px; }
.pl-del:active { transform: scale(0.86); }
@media (hover: hover) {
  .pl-del:hover { color: var(--fg); background: rgb(var(--fg-rgb) / 0.07); }
  .pl-item:hover .pl-del { color: var(--muted); }
  .pl-item:hover .pl-del:hover { color: var(--fg); }
}

/* the small round x (closes the day picker) */
.pl-x {
  position: relative; flex: none; display: grid; place-items: center;
  width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%;
  background: rgb(var(--fg-rgb) / 0.06); color: var(--muted); cursor: pointer;
  transition: color var(--dur-fast), background var(--dur-fast), transform var(--dur-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.pl-x svg { width: 15px; height: 15px; }
.pl-x:active { transform: scale(0.88); }
@media (hover: hover) { .pl-x:hover { color: var(--fg); background: rgb(var(--fg-rgb) / 0.11); } }

/* ---------- add ---------- */
.pl-add {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 50px;   /* the icon in the 24px check column, the label in line with the task text */
  padding: 12px 0; border: 0; background: none; cursor: pointer; text-align: left;
  font: 500 15px/1.3 var(--f-sans); letter-spacing: -0.012em; color: var(--muted);   /* add rows look the same on every screen */
  overflow-wrap: anywhere; -webkit-tap-highlight-color: transparent;
  transition: opacity var(--dur-fast), color var(--dur-fast);
}
.pl-add svg { width: 18px; height: 18px; margin: 0 3px; flex: none; }
.pl-add span { min-width: 0; }
.pl-add:active { opacity: 0.6; }
.pl-add:focus-visible { border-radius: 10px; }
@media (hover: hover) { .pl-add:hover { color: var(--fg); } }
.pl-new { border-bottom-color: var(--line-strong); }
.pl-new__mark { flex: none; display: grid; place-items: center; width: 24px; height: 24px; color: var(--faint); }
.pl-new__mark svg { width: 18px; height: 18px; }   /* the same + as the add button it replaces */

/* ---------- another day: our own calendar ---------- */
.pl-pick { padding-top: 14px; }
.pl-pick__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.pl-pick__label { min-width: 0; padding-left: 2px; font-size: 15px; font-weight: 600; letter-spacing: -0.012em; color: var(--muted); overflow-wrap: anywhere; }
.pl-pick__cal { padding: 0 0 6px; }
.pl-pick__cal.is-in, .pl-pick.is-in .pl-adder { animation: pl-fade 240ms var(--ease-out); }
@keyframes pl-fade { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.pl-pick .pl-adder { margin-top: 6px; }
.pl-pick__cal .dp { max-width: none; }

/* the chosen day: a pill you can tap to pick again */
.pl-chip {
  display: inline-flex; align-items: center; gap: 8px; min-width: 0; min-height: 40px; padding: 0 14px 0 12px;
  border: 0; border-radius: var(--r-pill); background: rgb(var(--fg-rgb) / 0.07); color: var(--fg); cursor: pointer;
  font: 600 15px/1.2 var(--f-sans); letter-spacing: -0.012em; text-align: left;
  transition: background var(--dur-fast), transform var(--dur-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.pl-chip > svg { width: 17px; height: 17px; flex: none; color: var(--muted); }
.pl-chip__text { display: inline-flex; flex-wrap: wrap; gap: 0 6px; min-width: 0; overflow-wrap: anywhere; }
.pl-chip__sep { color: var(--faint); }
.pl-chip__more { display: grid; place-items: center; color: var(--muted); }
.pl-chip__more svg { width: 15px; height: 15px; }
.pl-chip:active { transform: scale(0.97); }
@media (hover: hover) { .pl-chip:hover { background: rgb(var(--fg-rgb) / 0.11); } }

.pl-days { margin-top: 6px; }

@media (prefers-reduced-motion: reduce) {
  .pl-check, .pl-check svg, .pl-del, .pl-x, .pl-text, .pl-chip, .pl-clear { transition: none; }
  .pl-item.is-new, .pl-pick__cal.is-in, .pl-pick.is-in .pl-adder { animation: none; }
}

/* keyboard ring inside the row (PLAN v4 1.10): 8px of inner room each side, the text stays in place */
.pl-add { width: calc(100% + 16px); margin-inline: -8px; padding-inline: 8px; border-radius: 12px; }
/* "Clear" ends where the dates and the column end (its inner room reaches into the gutter, like the rows' rings) */
.pl-clear { margin-right: -8px; }
/* the delete button: a 44px tap area (the icon stays small) */
.pl-del::after { inset: -6px -6px -6px -6px; }

.td-plans__counted { margin: 0 0 8px; }

/* ---------- v7: ▷ Focus on a plan, → move it to tomorrow (Plan screen .pl-tools, Today .td-plan__tool) ---------- */
.pl-tools { flex: none; display: flex; align-items: center; gap: 2px; margin: -4px 0; }
.pl-tools[hidden] { display: none; }
.pl__tool, .td-plan__tool {
  position: relative; flex: none; display: grid; place-items: center;
  width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%;
  background: none; color: var(--faint); cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: color var(--dur-fast), background var(--dur-fast), transform var(--dur-fast) var(--ease-out), opacity var(--dur-fast);
}
.pl__tool::after, .td-plan__tool::after { content: ''; position: absolute; inset: -6px -3px; }
.pl__tool svg, .td-plan__tool svg { width: 16px; height: 16px; }
.pl__tool.pt-focus svg, .td-plan__tool.pt-focus svg { fill: currentColor; stroke-width: 1.4; width: 14px; height: 14px; }
.pl__tool:active, .td-plan__tool:active { transform: scale(0.86); }
@media (hover: hover) {
  .pl__tool:hover, .td-plan__tool:hover { color: var(--fg); background: rgb(var(--fg-rgb) / 0.07); }
  .pl-item:hover .pl__tool { color: var(--muted); }
  .pl-item:hover .pl__tool:hover { color: var(--fg); }
}
[data-screen="today"] .td-plan__tool { width: 34px; height: 34px; margin: 0 -2px; align-self: center; }
@media (hover: hover) and (pointer: fine) {
  [data-screen="today"] .td-plan__tool { opacity: 0; }
  [data-screen="today"] .td-plan:hover .td-plan__tool, [data-screen="today"] .td-plan:focus-within .td-plan__tool { opacity: 1; }
}

/* a plan a repeating rule put in: a small mark after the text */
.pl-rep-mark { flex: none; display: grid; place-items: center; width: 18px; height: 22px; color: var(--faint); }
.pl-rep-mark[hidden] { display: none; }
.pl-rep-mark svg { width: 14px; height: 14px; }

/* ---------- v7: Repeating ---------- */
.pl-rep { margin-top: 36px; }
.pl-rule { align-items: center; }
.pl-rule__ic { flex: none; display: grid; place-items: center; width: 24px; height: 24px; color: var(--muted); }
.pl-rule__ic svg { width: 17px; height: 17px; }
.pl-rule .pl-item__text { display: flex; flex-direction: column; gap: 2px; padding-top: 0; }
.pl-rule__text { font: 500 16px/1.35 var(--f-sans); letter-spacing: -0.012em; overflow-wrap: anywhere; }
.pl-rule__when { font-size: var(--t-small); color: var(--muted); }
.pl-rule__stop { flex: none; }
.pl-rep-form { padding: 2px 0 8px; }
.pl-rep-form[hidden], .pl-rep-open[hidden] { display: none; }
.pl-rep-kinds { padding-top: 14px; }
.pl-kinds { display: flex; flex-wrap: wrap; gap: 6px; }
.pl-wd { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 12px; }
.pl-wd[hidden] { display: none; }
.pl-wd__b { min-width: 44px; justify-content: center; padding: 0 10px; }
.pl-rep-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 14px; }
.pl-rep-note { margin: 10px 0 0; font-size: var(--t-small); line-height: 1.4; color: var(--muted); text-wrap: pretty; }
.pl-rep-note[hidden] { display: none; }
