/* ==========================================================================
   hours.css — the timesheet
   --------------------------------------------------------------------------
   A grid of small number fields is the whole page, so the grid is where the
   care goes: every cell the same width, digits that line up, today marked, and
   a focused cell that is unmistakable because people fill these in by tabbing
   without looking.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Week navigation
   -------------------------------------------------------------------------- */

.ts-weeknav {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.ts-weeknav__label { text-align: center; line-height: var(--leading-snug); min-width: 132px; }
.ts-weeknav__week { font-size: var(--text-md); font-weight: 600; }
.ts-weeknav__range { font-size: var(--text-xs); color: var(--text-muted); }

/* --------------------------------------------------------------------------
   Timer
   -------------------------------------------------------------------------- */

.ts-timer {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
}

.ts-timer__icon { width: 18px; height: 18px; stroke: var(--text-muted); fill: none; stroke-width: 1.7; flex-shrink: 0; }
.ts-timer__text { flex: 1; min-width: 140px; font-size: var(--text-sm); color: var(--text-secondary); }
.ts-timer .select { max-width: 260px; }

/* Running: the row picks up the accent and a pulse, because a timer you cannot
   see is a timer you forget. */
.ts-timer--on {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.ts-timer--on .ts-timer__text { color: var(--text-primary); }
.ts-timer__what { font-weight: 600; font-size: var(--text-md); }

.ts-timer__clock {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  color: var(--accent-soft-ink);
}

.ts-timer__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  animation: ts-pulse 1.6s ease-in-out infinite;
}

@keyframes ts-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* The same clock in the topbar, so it follows you off this page. */
.topbar__timer {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 30px;
  padding: 0 var(--space-3);
  border: 1px solid var(--accent);
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  white-space: nowrap;
}

.topbar__timer[hidden] { display: none !important; }
.topbar__timer:hover { background: var(--accent-soft-hover); }
.topbar__timer .ts-timer__dot { width: 8px; height: 8px; }

/* --------------------------------------------------------------------------
   The sheet
   -------------------------------------------------------------------------- */

.ts-scroll { overflow-x: auto; }

.ts {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.ts th,
.ts td {
  padding: var(--space-2) var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
  text-align: center;
  vertical-align: middle;
}

.ts thead th {
  padding-top: var(--space-3);
  font-size: var(--text-2xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.ts__what {
  width: 34%;
  min-width: 180px;
  padding-left: var(--space-4) !important;
  text-align: left !important;
  text-transform: none !important;
  letter-spacing: normal !important;
}

.ts__whatbox { display: flex; align-items: center; gap: var(--space-2); }
.ts__whattext { min-width: 0; flex: 1; }
.ts__project { display: block; font-size: var(--text-sm); font-weight: 500; color: var(--text-primary); text-decoration: none; }
.ts__project:hover { color: var(--text-link); text-decoration: underline; }
.ts__task { display: block; font-size: var(--text-2xs); color: var(--text-muted); }

/* Into the project's conversation, from the row where its hours are. Quiet
   until the row is touched, for the same reason as the board's. */
.ts__chat { flex-shrink: 0; opacity: 0; color: var(--text-muted); transition: opacity 120ms var(--ease); }
.ts tbody tr:hover .ts__chat,
.ts tbody tr:focus-within .ts__chat { opacity: 1; }

@media (hover: none) {
  .ts__chat { opacity: 1; }
}

.ts__day { min-width: 62px; }
.ts__dayname { display: block; }
/* --text-faint is a decorative ink and lands around 3.2:1 at 11px. Anything
   you have to read — and you read this to find today's column — is muted. */
.ts__daynum { display: block; font-weight: 400; letter-spacing: normal; text-transform: none; color: var(--text-muted); }

/* Today is where the cursor should land, so it is marked in the header, in
   every cell of the column, and nowhere else. */
.ts__day--today { color: var(--accent-soft-ink); }
.ts__cell--today { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }

.ts__total { min-width: 72px; }
.ts__strip { width: 44px; }

.ts__cell { padding: var(--space-1) !important; }

.ts__input {
  width: 100%;
  min-width: 52px;
  height: 34px;
  padding: 0 var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.ts__input:hover { border-color: var(--border-subtle); }

/* Unmistakable, because these get filled in by tabbing without looking. */
.ts__input:focus {
  outline: none;
  border-color: var(--border-focus);
  background: var(--surface-raised);
  box-shadow: var(--focus-ring);
}

.ts__input::placeholder { color: var(--text-faint); }

.ts__num { font-variant-numeric: tabular-nums; color: var(--text-secondary); }
.ts__num--row { font-weight: 600; color: var(--text-primary); }
.ts__num--long { color: var(--warning-ink); font-weight: 600; }

.ts tfoot th,
.ts tfoot td {
  border-bottom: 0;
  border-top: 2px solid var(--border-strong);
  padding-top: var(--space-3);
  font-weight: 600;
  color: var(--text-primary);
}

.ts__num--week { font-size: var(--text-md); }
.ts__empty { padding: var(--space-7) var(--space-4) !important; color: var(--text-muted); }

.ts-add { padding: var(--space-3) var(--space-4) var(--space-4); }

/* --------------------------------------------------------------------------
   Summary and submit
   -------------------------------------------------------------------------- */

.ts-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-5);
  padding: var(--space-5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
}

.ts-summary__label {
  font-size: var(--text-2xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-muted);
}

.ts-summary__value { font-size: var(--text-2xl); font-weight: 600; font-variant-numeric: tabular-nums; }
.ts-summary__against { font-size: var(--text-xs); color: var(--text-muted); }
.ts-summary__bar { display: grid; gap: var(--space-2); }
.ts-summary__bar .meter__fill { background: var(--accent); }
.ts-summary__diff { font-size: var(--text-xs); color: var(--text-muted); }
.ts-summary__diff--over { color: var(--warning-ink); }

.ts-summary__actions { display: grid; gap: var(--space-2); justify-items: end; }
.ts-summary__note { font-size: var(--text-xs); color: var(--text-muted); max-width: 200px; text-align: right; }

/* Things worth a second look, listed in the submit dialog. */
.dialog__notes {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--warning-bg);
  color: var(--warning-ink);
  font-size: var(--text-sm);
  list-style: disc;
  padding-left: var(--space-7);
}

/* --------------------------------------------------------------------------
   Hours on a project page
   -------------------------------------------------------------------------- */

.proj-hours {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  flex-wrap: wrap;
  padding-top: var(--space-4);
  margin-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

.proj-hours__figure { display: grid; gap: 2px; }
.proj-hours__value { font-size: var(--text-lg); font-weight: 600; font-variant-numeric: tabular-nums; }
.proj-hours__label { font-size: var(--text-2xs); font-weight: 600; letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--text-muted); }
.proj-hours__actions { margin-left: auto; }

/* --------------------------------------------------------------------------
   Responsive — the grid scrolls sideways rather than crushing the cells
   -------------------------------------------------------------------------- */

@media (max-width: 860px) {
  .ts { min-width: 720px; }
  .ts-summary { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
  .ts-summary__actions { justify-items: stretch; }
  .ts-summary__note { max-width: none; text-align: left; }
  .ts-weeknav { width: 100%; justify-content: space-between; }
}
