/* =========================================================================
   Tasks → Time log (src/features/timelog/TimeLogView.js; prefix tl-). The list column (the bar, the day, the blocks)
   rides .ctasks-main and the right panel rides .ctasks-detail (tasks.css), so the frame is the Tasks page's own.
   The approved draft: artifacts/time-log-mockup (deliberately minimal: no colour strip, a small donut under the kinds).
   Kind colours are tokens (--kind-*, tokens.css, with dark twins).
   ========================================================================= */
.k-work { --k: var(--kind-work); }
.k-food { --k: var(--kind-food); }
.k-health { --k: var(--kind-health); }
.k-travel { --k: var(--kind-travel); }
.k-phone { --k: var(--kind-phone); }
.k-people { --k: var(--kind-people); }
.k-rest { --k: var(--kind-rest); }
.tl-dot { display: inline-block; width: 7px; height: 7px; border-radius: var(--radius-full); flex-shrink: 0; background: var(--k, var(--kind-work)); }

.tl-main { max-width: 760px; gap: var(--space-5); }
.tl .tl-panel { width: 320px; margin-left: auto; flex-direction: column; overflow-y: auto; }

/* ---- the bar ---- */
.tl-now-wrap { position: relative; }
.tl-now {
  display: flex; align-items: center; gap: var(--space-3); height: 52px; padding: 0 var(--space-2) 0 var(--space-2);
  border: 1px solid var(--border-faint); border-radius: var(--radius-lg); background: var(--surface);
  transition: border-color var(--dur-fast) var(--ease);
}
.tl-now:focus-within { border-color: var(--border-strong); }
.tl-kind-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border: 0;
  border-radius: var(--radius-sm); background: transparent; cursor: pointer; flex-shrink: 0;
}
.tl-kind-btn .tl-dot { width: 9px; height: 9px; }
.tl-kind-btn:disabled { cursor: default; }
.tl-kind-btn[aria-expanded="true"] { background: var(--nav-active-bg); box-shadow: var(--press-inset-ghost); }
@media (hover: hover) and (pointer: fine) {
  .tl-kind-btn:hover { background: var(--nav-hover-bg); }
}
.tl-kind-menu { min-width: 170px; }
.tl-kind-menu .filter-opt .tl-dot { margin-right: var(--space-1); }
.tl-field { position: relative; flex: 1; min-width: 0; display: flex; }
.tl-input {
  position: relative; z-index: 1; width: 100%; min-width: 0; height: 32px; padding: 0; border: 0; outline: 0; background: none;
  font: inherit; font-size: var(--text-md); color: var(--text-strong);
}
.tl-input:focus, .tl-input:focus-visible { outline: none; box-shadow: none; }
.tl-input::placeholder { color: var(--text-placeholder); }
.tl-input:disabled { cursor: default; }
/* the rest of the top suggestion, after what's typed (Tab takes it) */
.tl-ghost {
  position: absolute; inset: 0; display: flex; align-items: center; white-space: pre; overflow: hidden; pointer-events: none;
  font-size: var(--text-md); color: var(--text-placeholder);
}
.tl-ghost i { font-style: normal; visibility: hidden; }
.tl-ghost .kbd { margin-left: var(--space-2); }
.tl-clock { font-variant-numeric: tabular-nums; font-size: var(--text-md); color: var(--text-strong); flex-shrink: 0; }
.tl-clock[hidden] { display: none; }
.tl-go {
  display: inline-flex; align-items: center; justify-content: center; width: var(--control-sm); height: var(--control-sm);
  padding: 0; border: 0; border-radius: var(--radius-full); flex-shrink: 0; cursor: pointer;
  background: var(--btn-primary-bg); color: var(--on-primary); box-shadow: var(--btn-primary-shadow);
}
.tl-go svg { width: 12px; height: 12px; }
.tl-go:not(.is-stop) svg { margin-left: 2px; }   /* the play triangle's optical centre */
.tl-go:active:not(:disabled) { box-shadow: var(--btn-primary-press); }
.tl-go:disabled { background: var(--surface-sunk); color: var(--text-placeholder); box-shadow: none; cursor: default; }
@media (hover: hover) and (pointer: fine) {
  .tl-go:not(:disabled):hover { background: var(--btn-primary-hover); }
}

/* the suggestions under a field (the shared .filter-menu surface) */
.tl-sugg { right: 0; }
.tl-sugg-h { padding: var(--space-1-5) var(--space-2-5) var(--space-1); font-size: var(--text-xs); color: var(--text-soft); }
.tl-opt { display: grid; grid-template-columns: 7px minmax(0, 1fr) auto; gap: var(--space-3); cursor: pointer; font-size: var(--text-sm); color: var(--text-strong); }
.tl-opt-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-opt b { font-weight: var(--fw-semibold); }
.tl-opt small { font-size: var(--text-xs); color: var(--text-soft); white-space: nowrap; }

/* ---- the day ---- */
.tl-day { display: flex; flex-direction: column; }
/* ‹ day › centred like the calendar's title, the day's total at the right (owner, 25 Nov 2026) */
.tl-dayhead { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--space-2); margin: var(--space-2) 0 var(--space-1); }
.tl-daynav { display: flex; align-items: center; gap: var(--space-1); min-width: 0; }
.tl-daynav .icon-ghost:disabled { opacity: 0.4; cursor: default; }
.tl-dayname { font: inherit; font-size: var(--text-md); font-weight: var(--fw-regular); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; border: none; background: none; padding: 2px var(--space-2); border-radius: var(--radius-sm); cursor: pointer; transition: background var(--dur) var(--ease); }
.tl-dayname strong { font-weight: var(--fw-semibold); color: var(--text-strong); }
.tl-dayname:disabled { cursor: default; }
.tl-daytotal { justify-self: end; white-space: nowrap; font-variant-numeric: tabular-nums; font-size: var(--text-sm); color: var(--text-muted); }
@media (hover: hover) and (pointer: fine) {
  .tl-dayname:not(:disabled):hover { background: var(--nav-hover-bg); }
}
.tl-entries { display: flex; flex-direction: column; }
.tl-entry {
  display: grid; grid-template-columns: 7px minmax(0, 1fr) auto 64px; align-items: center; gap: var(--space-3);
  height: 48px; padding: 0 var(--space-2); margin: 0 calc(-1 * var(--space-2)); border-bottom: 1px solid var(--border-faint);
  cursor: pointer;
}
.tl-entry--skel { cursor: default; }
.tl-skel-dot { width: 7px; height: 7px; border-radius: var(--radius-full); }
.tl-entry.sel { background: var(--surface-selected); }
@media (hover: hover) and (pointer: fine) {
  .tl-entry:not(.tl-entry--skel):hover { background: var(--surface-hover); }
}
.tl-entry:focus-visible { outline: none; box-shadow: var(--ring-primary); }
.tl-what { font-size: var(--text-md); color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-when { white-space: nowrap; font-variant-numeric: tabular-nums; font-size: var(--text-sm); color: var(--text-soft); }
.tl-dur { font-variant-numeric: tabular-nums; font-size: var(--text-sm); color: var(--text-strong); text-align: right; }
.tl-entry.is-live .tl-dur { color: var(--text-muted); }
.tl-entry.is-rest .tl-what { color: var(--text-soft); }
.tl-gap {
  display: flex; align-items: center; justify-content: space-between; height: 40px;
  padding-left: calc(7px + var(--space-3)); border-bottom: 1px solid var(--border-faint);
  font-size: var(--text-sm); color: var(--text-soft);
}
.tl-link { padding: var(--space-1) var(--space-1-5); margin-right: calc(-1 * var(--space-1-5)); border: 0; border-radius: var(--radius-sm); background: none; font: inherit; font-size: var(--text-sm); color: var(--text-muted); cursor: pointer; }
@media (hover: hover) and (pointer: fine) {
  .tl-link:hover { color: var(--text-strong); background: var(--nav-hover-bg); }
}
.tl-dayempty { margin-top: var(--space-10); }
.tl-add {
  align-self: flex-start; display: inline-flex; align-items: center; gap: var(--space-1-5); margin-top: var(--space-2);
  margin-left: calc(-1 * var(--space-2)); height: var(--control-sm); padding: 0 var(--space-2); border: 0; border-radius: var(--radius-sm);
  background: none; font: inherit; font-size: var(--text-sm); color: var(--text-soft); cursor: pointer;
}
.tl-add svg { width: 14px; height: 14px; }
@media (hover: hover) and (pointer: fine) {
  .tl-add:hover { color: var(--text-strong); background: var(--nav-hover-bg); }
}
.tl-quiet { margin-top: var(--space-6); }

/* ---- the panel: total, kinds, donut ---- */
.tl-sum { display: flex; flex-direction: column; gap: var(--space-6); padding: var(--space-8) var(--space-6); }
.tl-big { font-size: 34px; line-height: 1; font-weight: var(--fw-semibold); letter-spacing: -0.02em; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.tl-since { margin: var(--space-2) 0 0; font-size: var(--text-sm); color: var(--text-soft); }
.tl-rows { display: flex; flex-direction: column; }
.tl-row {
  display: flex; justify-content: space-between; align-items: center; height: 36px; padding: 0 var(--space-2);
  margin: 0 calc(-1 * var(--space-2)); border-radius: var(--radius-md); font-size: var(--text-sm); cursor: default;
  transition: background var(--dur-fast) var(--ease);
}
.tl-row.on { background: var(--surface-selected); }
.tl-row:focus-visible { outline: none; box-shadow: var(--ring-primary); }
.tl-row-n { display: flex; align-items: center; gap: var(--space-2-5); color: var(--text); }
.tl-row-h { font-variant-numeric: tabular-nums; color: var(--text-strong); }
.tl-donut { position: relative; width: 168px; height: 168px; margin: 0 auto; }
.tl-donut svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.tl-slice { fill: none; stroke: var(--k); stroke-width: 14; cursor: pointer; transition: stroke-width var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease); }
.tl-donut.is-hov .tl-slice { opacity: 0.35; }
.tl-donut.is-hov .tl-slice.on { opacity: 1; stroke-width: 17; }
.tl-dlabel { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; white-space: nowrap; }
.tl-dlabel b { display: block; font-size: var(--text-md); font-weight: var(--fw-semibold); color: var(--text-strong); font-variant-numeric: tabular-nums; }
.tl-dlabel span { font-size: var(--text-xs); color: var(--text-muted); }

/* ---- the editor (the panel on desktop, a sheet on phones) ---- */
.tl-editor { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.tl-ed-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-5) var(--space-5) var(--space-2) var(--space-6); }
.tl-ed-title { font-size: var(--text-md); font-weight: var(--fw-semibold); color: var(--text-strong); }
.tl-ed-body { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-3) var(--space-6) var(--space-5); }
.tl-editor .tl-ed-body { flex: 1; overflow-y: auto; }
.tl-drawer .tl-ed-body { gap: var(--space-4); }
.tl-ed-what { position: relative; }
.tl-ed-field { position: relative; display: flex; }
.tl-ed-field .input { width: 100%; }
.tl-ed-ghost { left: 12px; right: 12px; font-size: var(--text-md); }
.tl-ed-field .input { position: relative; z-index: 1; background: transparent; }
.tl-ed-field { background: var(--surface); border-radius: var(--radius-sm); }
.tl-ed-sugg { top: calc(100% + 4px); }
.tl-ed-times { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.input-pick [data-pick-text] { display: inline-flex; align-items: center; gap: var(--space-2); }
.tl-time-menu { max-height: calc(var(--control-sm) * 8 + var(--space-2)); min-width: 140px; }
.tl-ed-dur { margin: calc(-1 * var(--space-2)) 0 0; font-size: var(--text-xs); color: var(--text-soft); font-variant-numeric: tabular-nums; }
.tl-ed-dur:empty { display: none; }
.tl-ed-body .field-msg { margin-top: calc(-1 * var(--space-2)); }
.tl-ed-clash { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); padding: var(--space-3); border: 1px solid var(--border-faint); border-radius: var(--radius-md); background: var(--surface-sunk); }
.tl-ed-clash[hidden] { display: none; }
.tl-ed-clash p { margin: 0; font-size: var(--text-sm); line-height: var(--leading-snug); color: var(--text); }
.tl-ed-clash strong { font-weight: var(--fw-semibold); color: var(--text-strong); }
.tl-nowrap { white-space: nowrap; }
.tl-ed-foot { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-4) var(--space-6); border-top: 1px solid var(--border-faint); }

@media (prefers-reduced-motion: reduce) {
  .tl-slice, .tl-row, .tl-now { transition: none; }
}

/* tablet: the panel narrows with the Tasks one */
@media (max-width: 1024px) {
  .tl .tl-panel { width: 300px; }
}
/* phones: one column, the day's summary under the list; the editor is a sheet */
@media (max-width: 640px) {
  .tl { flex-direction: column; align-items: stretch; }
  .tl .tl-panel {
    display: flex; position: static; width: auto; height: auto; margin: var(--space-4) 0 0; overflow: visible;
    border-left: 0; border-top: 1px solid var(--border-faint);
  }
  .tl-sum { padding: var(--space-6) 0 calc(var(--space-12) + var(--safe-bottom)); }
  .tl-now { height: 52px; }
  .tl-entry { grid-template-columns: 7px minmax(0, 1fr) auto; grid-template-rows: auto auto; row-gap: 2px; height: auto; min-height: 56px; padding-top: var(--space-2); padding-bottom: var(--space-2); }
  .tl-entry .tl-dot { grid-row: 1 / span 2; }
  .tl-entry .tl-when { grid-column: 2; grid-row: 2; font-size: var(--text-xs); }
  .tl-entry .tl-dur { grid-column: 3; grid-row: 1 / span 2; }
  .tl-ghost .kbd { display: none; }
  /* a time sheet scrolls to the field's time: its header stays put above the list */
  .tl-time-menu.filter-sheet .sheet-head {
    position: sticky; top: calc(-1 * var(--space-3)); z-index: 1; background: var(--surface);
    margin-top: calc(-1 * var(--space-3)); padding-top: var(--space-3);
  }
  .tl-time-menu.filter-sheet .sheet-head-title { top: 50%; }   /* (its padding is even now: 12px above and below) */
  .tl-ed-body { padding: var(--space-3) var(--space-5) var(--space-5); }
  .tl-ed-foot { padding: var(--space-3) var(--space-5); }
}
