/* ==========================================================================
   Time tracking: timesheets, timers, Pomodoro. Module stylesheet: tokens only, shared parts live in components.css.
   ========================================================================== */

/* ---- Time tracking ------------------------------------------------------------------------------------------- */
.tm-pill { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 2px 0 10px; border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--surface); max-width: 260px; margin-inline-end: 4px; }
.tm-pill__main { display: inline-flex; align-items: center; gap: 8px; color: var(--text); min-width: 0; text-decoration: none; font-size: var(--fs-sm); }
.tm-pill__main:hover { text-decoration: none; color: var(--accent-text); }
.tm-pill__label { color: var(--text-muted); max-width: 120px; }
.tm-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger, #dc2626); flex: none; animation: tm-pulse 1.6s ease-in-out infinite; }
.tm-stop { width: 24px; height: 24px; color: var(--danger, #dc2626); }
@keyframes tm-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .tm-dot { animation: none; } }
@media (max-width: 767.98px) { .tm-pill__label { display: none; } .tm-pill { margin-inline-end: 0; } }
.tm-bigclock { font-size: 2.1rem; font-weight: var(--fw-semibold); line-height: 1.1; margin-block-end: 4px; font-variant-numeric: tabular-nums; }
.tm-day.is-today { border-color: var(--accent); }
.tm-day .m-card__head { background: var(--surface-2); border-start-start-radius: inherit; border-start-end-radius: inherit; }
.tm-day .m-card__title { font-weight: var(--fw-medium); }
.tm-entry.is-running { background: var(--accent-soft); }
.tm-elapsed { min-width: 4.5rem; text-align: end; font-variant-numeric: tabular-nums; }
@media (max-width: 767.98px) { .tm-entry .m-list__main { flex: 1 1 calc(100% - 3rem); min-width: 0; } .tm-entry small { overflow-wrap: anywhere; } }

/* ---- Timers (several can run at once) & Pomodoro --------------------------------------------------------------------- */
button.tm-pill { cursor: pointer; padding-inline: 10px; color: var(--text); font: inherit; }
button.tm-pill:hover { border-color: var(--border-strong); }
.tm-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.tm-menu { min-width: 300px; max-width: min(360px, calc(100vw - 24px)); padding-block-end: 4px; }
.tm-menu__foot { border-block-start: 1px solid var(--border); margin-block-start: 4px; padding-block-start: 4px; }
.tm-timers { display: flex; flex-direction: column; gap: var(--sp-2); }
.tm-timer { display: flex; align-items: center; gap: var(--sp-2); padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); min-width: 0; }
.tm-timer--compact { border: 0; border-radius: 0; background: transparent; padding: 6px 12px; }
.tk-time .tm-timer--compact { padding: 6px 0; }
.tm-timer__main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.tm-timer__title { font-weight: 500; color: var(--text); }
.tm-timer__meta { color: var(--text-faint); font-size: var(--fs-xs); }
.tm-timer__clock { font-variant-numeric: tabular-nums; font-size: var(--fs-md, 1rem); }
.tm-src { color: var(--text-faint); }
.tm-bar { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--sp-2); }
.tm-bar__nav { display: flex; align-items: center; gap: 2px; }
.tm-filters { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; flex: 1 1 0; min-width: 0; }
.tm-filters > * { min-width: 0; }
.tm-filters__date { width: auto; flex-direction: row; align-items: center; gap: 6px; }
.tm-filters__date .m-field__label { white-space: nowrap; color: var(--text-muted); font-weight: var(--fw-regular); }
.tm-filters__date .m-field__error { display: none; }
.tm-filters__date .m-input, .tm-filters__date input { width: 138px; }
@media (max-width: 767.98px) { .tm-filters > * { flex: 1 1 calc(50% - 8px); } .tm-filters__date { width: auto; } .tm-menu { min-width: 260px; } }

.pm-widget { min-width: 0; }
.pm-widget--compact { margin-block-start: var(--sp-2); padding: var(--sp-2) var(--sp-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); }
.pm-target { margin-block-end: var(--sp-2); }
.pm-idle { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.pm-idle__icon { font-size: 1.4rem; color: var(--text-faint); }
.pm-idle__text { display: flex; flex-direction: column; flex: 1; min-width: 120px; }
.pm-idle__text small { color: var(--text-muted); }
.pm-today { margin: var(--sp-2) 0 0; font-size: var(--fs-xs); color: var(--text-muted); }
.pm-active { display: grid; grid-template-columns: auto 1fr; gap: 2px var(--sp-3); align-items: center; }
.pm-clock { font-size: 2.4rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--accent-text, var(--accent)); }
.pm-active--short_break .pm-clock, .pm-active--long_break .pm-clock { color: var(--success-2, #15803d); }
.pm-active.is-paused .pm-clock { opacity: .55; }
.pm-widget--compact .pm-clock { font-size: 1.7rem; }
.pm-info { display: flex; flex-direction: column; min-width: 0; }
.pm-type { font-weight: 600; }
.pm-pos { color: var(--text-muted); }
.pm-label { font-size: var(--fs-sm); max-width: 100%; }
.pm-bar { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; margin-block: var(--sp-2); }
.pm-bar span { display: block; height: 100%; background: var(--accent); transition: width .6s linear; }
.pm-active--short_break .pm-bar span, .pm-active--long_break .pm-bar span { background: var(--success-2, #15803d); }
.pm-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: var(--sp-2); }
@media (prefers-reduced-motion: reduce) { .pm-bar span { transition: none; } }

/* Header Pomodoro quick-start */
.pm-header__btn { width: auto; min-width: 32px; gap: 6px; }
.pm-header__btn.is-active { color: var(--accent-text, var(--accent)); padding-inline: 8px; }
.pm-header__btn.is-break { color: var(--success-2, #15803d); }
.pm-header__clock { font-size: var(--fs-sm); font-weight: 600; font-variant-numeric: tabular-nums; }
.pm-header__menu { min-width: 280px; max-width: min(340px, calc(100vw - 24px)); padding-block-end: 4px; }
.pm-header__body { padding: 6px 12px 8px; }
.pm-header__menu .pm-clock { font-size: 1.9rem; }
.pm-header__menu .pm-idle__text small { display: none; }
@media (max-width: 767.98px) { .pm-header__clock { display: none; } .pm-header__btn.is-active { background: var(--accent-soft, transparent); } }

/* "Start a Pomodoro": choose a ready-made set */
.pm-choose { display: grid; gap: 6px; }
.pm-choose__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.pm-set { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); color: inherit; text-align: start; cursor: pointer; }
.pm-set span { font-size: var(--fs-sm); color: var(--text-muted); }
.pm-set:hover, .pm-set:focus-visible { border-color: var(--accent); }
.pm-set.is-on { border-color: var(--accent); background: var(--accent-soft, var(--surface-hover)); }

/* Header Pomodoro: the countdown sits NEXT to the hourglass (one row), never underneath it */
.pm-header__btn { display: inline-flex; flex-direction: row; align-items: center; justify-content: center; flex-wrap: nowrap; white-space: nowrap; height: var(--ctl-h, 32px); line-height: 1; }
.pm-header__btn .pm-header__clock { display: inline; margin: 0; }
.pm-header__btn .pm-header__clock[hidden] { display: none; }

/* Pomodoro chip on a project card of the board */
.pm-widget--chip { display: inline-flex; align-items: center; margin-inline-start: auto; }
.pm-chip { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-sm); }
.pm-chip.is-active { color: var(--accent-text, var(--accent)); background: var(--accent-soft, var(--surface-hover)); border-radius: 999px; padding: 1px 4px 1px 8px; }
.pm-chip.is-break { color: var(--success-2, #15803d); }
.pm-chip__clock { font-weight: 600; font-variant-numeric: tabular-nums; }
.pm-chip .icon-btn { width: 22px; height: 22px; font-size: .8rem; }
.pm-chip__start { opacity: 0; }
.bk-card:hover .pm-chip__start, .bk-card:focus-within .pm-chip__start, .pm-chip__start:focus-visible { opacity: 1; }
@media (hover: none) { .pm-chip__start { opacity: .75; } }

/* Pomodoro: note for the running set (+ link it to a task/project when it was started without one) */
.pm-note { display: grid; gap: var(--s-2, 8px); margin-top: var(--s-3, 12px); }
.pm-note__input { width: 100%; }
.pm-note [data-pm-target-slot]:empty { display: none; }
.pm-note .m-select { width: 100%; }

/* "Start" opens the sets as a dropdown right under the button instead of replacing the widget */
.pm-start-wrap { position: relative; display: inline-flex; }
.pm-pop { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 40; width: 270px; max-width: 80vw; display: grid; gap: 6px; padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-lg, 0 10px 30px rgba(0, 0, 0, .25)); }

/* Reports: the entries behind a group's totals */
.rp-detail > td { padding: 0 !important; background: var(--surface-2, color-mix(in srgb, var(--text) 4%, transparent)); }
.rp-items { width: 100%; margin: 0; }
.rp-items th { font-size: var(--fs-xs); color: var(--text-muted); font-weight: var(--fw-medium); }
.rp-items td, .rp-items th { padding: 6px 12px; }
[data-rp-row] td:first-child { cursor: pointer; }

/* Several sets at once: the other running sets listed under the one shown, and a count on the header button */
.pm-others { display: grid; gap: 6px; margin-top: var(--sp-3, 12px); }
.pm-other { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--r-md); font-size: var(--fs-sm); }
.pm-other__label { flex: 1; min-width: 0; }
.pm-header__btn[data-count]:not([data-count=""])::after { content: attr(data-count); position: absolute; top: -2px; inset-inline-end: -2px; min-width: 1rem; padding: 0 4px; border-radius: 99px; background: var(--accent); color: #fff; font-size: .65rem; line-height: 1rem; text-align: center; }
.pm-header__btn { position: relative; }

/* Timesheets page: a quiet stats line, one filter row, the table as the main thing */
.ts-stats { display: flex; flex-wrap: wrap; gap: 6px var(--sp-5); align-items: center; margin-block-end: var(--sp-3); font-size: var(--fs-sm); color: var(--text-muted); }
.ts-stat { display: inline-flex; align-items: center; gap: 6px; }
.ts-stat .bi { color: var(--text-faint); }
.ts-stat strong { color: var(--text); font-weight: var(--fw-semibold); }
.ts-running { margin-block-end: var(--sp-3); padding: var(--sp-2) var(--sp-3); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.ts-running[hidden] { display: none; }
.ts-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px var(--sp-3); margin-block-end: var(--sp-2); }
.ts-toolbar__nav { display: inline-flex; align-items: center; gap: 4px; }
.ts-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex: 1 1 auto; min-width: 0; }
.ts-filters .m-input, .ts-filters .m-select { height: 32px; min-height: 32px; }
.ts-filters .tm-filters__date { width: 150px; }
.ts-filters > .m-field, .ts-filters > .m-select { margin: 0; }
.ts-filters select { max-width: 170px; }
.ts-toolbar__views { margin-inline-start: auto; }
.tm-table td:nth-child(3), .tm-table th:nth-child(3) { min-width: 220px; }
