/* components.css - task rows, chips, inputs, checkboxes */

  /* ---------- Row extras: due, repeat, flag, subtasks ---------- */

  .task-due {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    white-space: nowrap;
  }
  .task-due.hidden { display: none; }
  .task-due.overdue { color: var(--danger); }

  .task-rep {
    flex-shrink: 0;
    display: inline-flex;
    color: var(--text-tertiary);
    margin: 0 -6px;
  }
  .task-rep.hidden { display: none; }

  .flagbtn.on { opacity: 1; color: var(--g-red); }
  .flagbtn.on:hover { color: var(--g-red); }
  .flagbtn.on svg { fill: currentColor; }

  .sub-count {
    flex-shrink: 0;
    font-size: 12px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
  }
  .sub-count.hidden { display: none; }

  .expand svg { transition: transform 0.25s var(--spring); }
  .expand.open { opacity: 1; }
  .expand.open svg { transform: rotate(90deg); }
  .task.has-subs .expand { opacity: 1; }

  .sub-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px 0 66px;
    min-height: 40px;
    position: relative;
  }
  .sub-row .check { width: 18px; height: 18px; }
  .sub-row .check::before { inset: -10px; }
  .sub-text {
    flex: 1;
    min-width: 0;
    font-size: 15px;
    letter-spacing: -0.01em;
    color: var(--text);
    padding: 9px 0;
    overflow-wrap: break-word;
    transition: color 0.3s;
  }
  .sub-row.done .sub-text { color: var(--text-secondary); text-decoration: line-through; }
  .sub-row .del { width: 28px; height: 28px; }
  .sub-edit {
    flex: 1;
    appearance: none;
    border: none;
    outline: none;
    background: transparent;
    font: inherit;
    font-size: 15px;
    letter-spacing: -0.01em;
    color: var(--text);
    padding: 9px 0;
    min-width: 0;
  }

  .sub-add {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px 4px 66px;
    min-height: 36px;
  }
  .sub-add .plus-icon { width: 18px; height: 18px; }
  .sub-input {
    flex: 1;
    appearance: none;
    border: none;
    outline: none;
    background: transparent;
    font: inherit;
    font-size: 15px;
    letter-spacing: -0.01em;
    color: var(--text);
    padding: 8px 0;
    min-width: 0;
  }
  .sub-input::placeholder { color: var(--text-tertiary); }

  .sub-row + .task::before,
  .sub-add + .task::before {
    content: "";
    position: absolute;
    top: 0;
    left: 66px;
    right: 0;
    height: 1px;
    background: var(--separator);
  }

  .date-input {
    appearance: none;
    border: none;
    outline: none;
    background: transparent;
    font: inherit;
    font-size: 15px;
    letter-spacing: -0.01em;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    padding: 8px 0;
    cursor: text;
    transition: color 0.15s;
  }
  .date-input:focus { color: var(--accent); }
  .date-input::-webkit-calendar-picker-indicator { opacity: 0.35; cursor: pointer; }
  .date-input:hover::-webkit-calendar-picker-indicator { opacity: 0.7; }

  .routine-del {
    appearance: none;
    border: none;
    background: transparent;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px 0;
    text-align: left;
    transition: color 0.15s;
    touch-action: manipulation;
  }
  .routine-del:hover { color: var(--danger); }

  /* ---------- Day navigation ---------- */

  .day-nav { display: flex; align-items: center; gap: 2px; padding-top: 2px; }

  .nav-btn {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: background 0.15s, color 0.15s, transform 0.15s var(--spring);
    touch-action: manipulation;
  }
  .nav-btn::before { content: ""; position: absolute; inset: -5px; border-radius: 50%; }
  .nav-btn:hover { background: var(--btn-hover); color: var(--text); }
  .nav-btn:active { transform: scale(0.92); }

  .today-pill {
    appearance: none;
    border: none;
    background: var(--accent-soft);
    color: var(--accent);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 13px;
    border-radius: 980px;
    cursor: pointer;
    margin: 0 4px;
    transition: transform 0.2s var(--spring), opacity 0.2s, background 0.15s;
    touch-action: manipulation;
  }
  .today-pill:hover { background: var(--accent); color: #fff; }
  .today-pill:active { transform: scale(0.95); }
  .today-pill.hidden { display: none; }

  /* ---------- Group chips ---------- */

  .chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 0 28px 10px;
  }

  .chip {
    appearance: none;
    border: none;
    cursor: pointer;
    font: inherit;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.01em;
    padding: 7px 13px;
    border-radius: 980px;
    background: var(--chip-bg);
    color: var(--text-secondary);
    max-width: 100%;
    transition: background 0.15s, color 0.15s, transform 0.15s var(--spring);
    touch-action: manipulation;
  }
  .chip:hover { background: var(--btn-hover); color: var(--text); }
  .chip:active { transform: scale(0.96); }
  .chip[aria-pressed="true"] { background: var(--text); color: var(--card); }
  .chip[aria-pressed="true"]:hover { background: var(--text); color: var(--card); }

  .chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 160px;
  }

  .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gc, var(--accent));
    flex-shrink: 0;
  }
  /* on the inverted (selected) pill, shift the dot towards the card color
     so it keeps >=3:1 contrast against the inverted background in both themes */
  .chip[aria-pressed="true"] .dot {
    background: color-mix(in srgb, var(--gc, var(--accent)) 70%, var(--card));
  }

  .chip-del {
    appearance: none;
    border: none;
    background: transparent;
    cursor: pointer;
    width: 26px;
    height: 26px;
    margin-left: -2px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    position: relative;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
    touch-action: manipulation;
  }
  .chip-del::before { content: ""; position: absolute; inset: -8px; border-radius: 50%; }
  .chip-del:hover { color: var(--danger); background: var(--btn-hover); }

  .chip-new {
    padding: 7px 10px;
    background: transparent;
    color: var(--text-tertiary);
  }
  .chip-new:hover { color: var(--accent); background: var(--chip-bg); }

  .chip-input {
    appearance: none;
    border: none;
    outline: none;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.01em;
    background: var(--chip-bg);
    color: var(--text);
    border-radius: 980px;
    padding: 7px 13px;
    width: 140px;
  }
  .chip-input::placeholder { color: var(--text-tertiary); font-weight: 500; }

  /* ---------- Add row ---------- */

  .add-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 28px;
    min-height: 52px;
  }
  .add-row.hidden { display: none; }

  .plus-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    transition: color 0.2s, transform 0.2s var(--spring);
  }
  .add-row:focus-within .plus-icon { color: var(--accent); transform: rotate(90deg); }

  .add-input {
    appearance: none;
    border: none;
    background: transparent;
    font: inherit;
    font-size: 17px;
    letter-spacing: -0.01em;
    color: var(--text);
    width: 100%;
    padding: 12px 0;
    outline: none;
  }
  .add-input::placeholder { color: var(--text-tertiary); }

  .time-input {
    appearance: none;
    border: none;
    outline: none;
    background: transparent;
    font: inherit;
    font-size: 15px;
    letter-spacing: -0.01em;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    padding: 8px 0;
    cursor: text;
    transition: color 0.15s;
  }
  .time-input:focus { color: var(--accent); }
  .time-input::-webkit-calendar-picker-indicator {
    opacity: 0.35;
    cursor: pointer;
    transition: opacity 0.15s;
  }
  .time-input:hover::-webkit-calendar-picker-indicator { opacity: 0.7; }

  /* ---------- Task list ---------- */

  .tasks { list-style: none; }

  .section {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 18px 28px 6px;
    transition: opacity 0.25s ease;
  }
  .section.removing {
    opacity: 0;
    min-height: 0 !important;
    max-height: 0 !important;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
    transition: opacity 0.2s ease-in, max-height 0.25s ease-in 0.05s,
                padding 0.25s ease-in 0.05s;
  }

  .section-ring { flex-shrink: 0; }
  .s-track { stroke: var(--separator); }
  .s-fill {
    stroke: var(--gc, var(--accent));
    transition: stroke-dashoffset 0.45s var(--ease-out), stroke 0.3s;
  }
  .section.done .s-fill { stroke: var(--success); }

  .section-name {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .section-count {
    margin-left: auto;
    font-size: 13px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    padding-left: 10px;
  }

  .task {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 20px 0 28px;
    min-height: 52px;
    position: relative;
    transition: opacity 0.25s ease, transform 0.25s ease;
  }
  .task.entering { animation: task-in 0.28s var(--ease-out) both; }
  @keyframes task-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: none; }
  }
  .task.removing {
    opacity: 0;
    transform: translateX(12px);
    transition: opacity 0.22s ease-in, transform 0.22s ease-in,
                min-height 0.25s ease-in 0.1s, max-height 0.25s ease-in 0.1s;
    min-height: 0 !important;
    max-height: 0 !important;
    overflow: hidden;
  }
  .task.dragging { opacity: 0.35; }

  .task + .task::before {
    content: "";
    position: absolute;
    top: 0;
    left: 66px;
    right: 0;
    height: 1px;
    background: var(--separator);
  }

  .task-time {
    flex-shrink: 0;
    font-size: 15px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    padding: 13px 0;
    cursor: pointer;
    transition: color 0.3s;
  }
  .task-time.hidden { display: none; }
  .task-time.overdue { color: var(--danger); }
  .task.done .task-time { color: var(--text-tertiary); }

  .task-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gc, var(--accent));
    flex-shrink: 0;
    margin: 0 -4px;
  }
  .task-dot.hidden { display: none; }

  /* partial-progress badge: attention orange so unfinished work stands out */
  .task-prog {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
    color: color-mix(in srgb, var(--g-orange) 72%, var(--text));
    background: color-mix(in srgb, var(--g-orange) 14%, transparent);
    padding: 3px 8px;
    border-radius: 980px;
    cursor: pointer;
    transition: background 0.15s;
  }
  .task-prog:hover { background: color-mix(in srgb, var(--g-orange) 24%, transparent); }
  .task-prog.hidden { display: none; }

  .prog-wrap { display: flex; align-items: center; gap: 1px; flex-shrink: 0; }
  .prog-input {
    appearance: none;
    border: none;
    outline: none;
    background: transparent;
    font: inherit;
    font-size: 15px;
    letter-spacing: -0.01em;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    width: 42px;
    text-align: right;
    padding: 8px 0;
  }
  .prog-input:focus { color: var(--accent); }
  .prog-input::-webkit-outer-spin-button,
  .prog-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
  .prog-suffix { font-size: 15px; color: var(--text-tertiary); }

  /* ---------- Checkbox ---------- */

  .check {
    appearance: none;
    border: none;
    background: transparent;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    padding: 0;
    cursor: pointer;
    position: relative;
    color: var(--check-border);
    transition: color 0.15s;
    touch-action: manipulation;
  }
  .check::before { content: ""; position: absolute; inset: -12px; }
  .check:hover { color: var(--accent); }

  .check-circle { width: 100%; height: 100%; display: block; }
  .check-circle .c-ring {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    transition: stroke 0.2s;
  }
  .check-circle .c-prog {
    fill: none;
    stroke: var(--g-orange);
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-dasharray: 65.97;
    stroke-dashoffset: 65.97;
    opacity: 0;
    transition: stroke-dashoffset 0.35s var(--ease-out), opacity 0.2s;
  }
  .task.partial .c-prog { opacity: 1; }
  .check-circle .c-fill {
    fill: var(--accent);
    transform: scale(0);
    transform-origin: center;
    transition: transform 0.25s var(--spring);
  }
  .check-circle .c-mark {
    fill: none;
    stroke: #fff;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 16;
    stroke-dashoffset: 16;
    transition: stroke-dashoffset 0.25s ease-out 0.1s;
  }

  .task.done .check, .sub-row.done .check { color: var(--accent); }
  .task.done .c-fill, .sub-row.done .c-fill { transform: scale(1); }
  .task.done .c-mark, .sub-row.done .c-mark { stroke-dashoffset: 0; }
  /* pop plays only on an actual state change (toggle sets .pop), so
     re-renders don't replay the animation on every completed row */
  .task.pop .check-circle { animation: check-pop 0.35s var(--spring); }
  @keyframes check-pop {
    0% { transform: scale(1); }
    40% { transform: scale(0.82); }
    70% { transform: scale(1.12); }
    100% { transform: scale(1); }
  }

  /* ---------- Task label ---------- */

  .task-label {
    flex: 1;
    font-size: 17px;
    letter-spacing: -0.01em;
    line-height: 1.45;
    padding: 13px 0;
    min-width: 0;
    overflow-wrap: break-word;
    cursor: default;
    color: var(--text);
    transition: color 0.3s;
  }
  .task-text {
    background-image: linear-gradient(var(--text-secondary), var(--text-secondary));
    background-size: 0% 1px;
    background-position: 0 56%;
    background-repeat: no-repeat;
    transition: background-size 0.3s var(--ease-out);
  }
  .task.done .task-label { color: var(--text-secondary); }
  .task.done .task-text { background-size: 100% 1px; }

  .edit-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
  }

  .edit-input {
    flex: 1;
    appearance: none;
    border: none;
    outline: none;
    background: transparent;
    font: inherit;
    font-size: 17px;
    letter-spacing: -0.01em;
    color: var(--text);
    padding: 13px 0;
    min-width: 0;
  }

  /* ---------- Row action buttons ---------- */

  .row-btn {
    appearance: none;
    border: none;
    background: transparent;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    cursor: pointer;
    opacity: 0;
    position: relative;
    transition: opacity 0.15s, color 0.15s, background 0.15s, transform 0.15s var(--spring);
    touch-action: manipulation;
  }
  .row-btn::before { content: ""; position: absolute; inset: -6px; border-radius: 50%; }
  .task:hover .row-btn, .row-btn:focus-visible { opacity: 1; }
  .row-btn:active { transform: scale(0.9); }
  .del:hover { color: var(--danger); background: var(--btn-hover); }
  .take:hover { color: var(--accent); background: var(--btn-hover); }
  .take[aria-pressed="true"] { opacity: 1; color: var(--accent); }
  .take.hidden, .expand.hidden, .flagbtn.hidden { display: none; }
  @media (hover: none) { .row-btn { opacity: 0.6; } }

