/* timesheet.css — Clockify-style week grid, keyed on Master ID + Work Category.
   Uses the existing TSN Pulse palette (styles.css :root) so the tab sits
   inside the product rather than beside it. No external fonts or assets. */

/* ------------------------------------------------------------------ card */
.ts-card { padding: 0; overflow: hidden; }

.ts-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.ts-grid {
  width: 100%;
  min-width: 860px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.88rem;
}

/* ---------------------------------------------------------------- header */
.ts-grid thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--row-head);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
  padding: 0.7rem 0.5rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.ts-grid thead th.ts-c-day,
.ts-grid thead th.ts-c-total { text-align: center; }

.ts-grid thead th.ts-c-day.today { color: var(--blue); }

.ts-dname { display: block; }
.ts-ddate {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  opacity: 0.75;
}

/* ------------------------------------------------------------------ rows */
.ts-row td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.ts-row:hover td { background: var(--hover); }

.ts-c-master { white-space: nowrap; }

.ts-dot {
  display: inline-block;
  width: 7px; height: 7px;
  margin-right: 0.5rem;
  border-radius: 50%;
  background: var(--pink);
  vertical-align: middle;
}

.ts-master { font-weight: 600; color: var(--text); }
.ts-master.unset { font-weight: 400; color: var(--muted); font-style: italic; }

.ts-c-cat { color: var(--text); white-space: nowrap; }

.ts-c-desc { color: var(--muted); max-width: 20rem; }
.ts-desc { margin-right: 0.4rem; }

.ts-chip {
  display: inline-block;
  margin-left: 0.3rem;
  padding: 0.05rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.7rem;
  color: var(--muted);
}

.ts-empty td {
  padding: 1.6rem 0.9rem;
  color: var(--muted);
  text-align: center;
}

/* -------------------------------------------------------------- day cells */
.ts-c-day { text-align: center; }

.ts-cell {
  width: 4.4rem;
  padding: 0.34rem 0.25rem;
  text-align: center;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.ts-cell:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(47, 180, 240, 0.18);
}

.ts-cell:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ts-cell.saving { border-color: var(--pulse); }

.ts-c-total {
  text-align: right;
  white-space: nowrap;
  font-family: ui-monospace, Consolas, monospace;
}

.ts-c-total.strong { color: var(--text); font-weight: 700; }

.ts-c-actions { width: 2.4rem; text-align: right; }

.ts-del { opacity: 0; transition: opacity 0.12s ease; }
.ts-row:hover .ts-del,
.ts-del:focus { opacity: 1; }

/* ------------------------------------------------------------------ foot */
.ts-foot-row td {
  padding: 0.6rem 0.65rem;
  background: var(--row-head);
  border-top: 1px solid var(--border);
  font-family: ui-monospace, Consolas, monospace;
  color: var(--text);
}

.ts-foot-row .ts-c-total-label {
  font-family: inherit;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ts-foot-row .ts-c-day { text-align: center; }

/* ---------------------------------------------------------------- add bar */
.ts-addbar {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.7rem 0.8rem;
  border-top: 1px solid var(--border);
}

.ts-add {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--blue);
  padding: 0.42rem 0.85rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.87rem;
}

.ts-add:hover { border-color: var(--blue); background: rgba(47, 180, 240, 0.06); }
.ts-plus { margin-right: 0.35rem; font-weight: 700; }

/* ---------------------------------------------------------------- picker */
.ts-picker {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 22, 34, 0.42);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 1rem 1rem;
}

.ts-picker.hidden { display: none; }

.ts-picker-panel {
  width: min(600px, 100%);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow), 0 18px 48px rgba(20, 30, 55, 0.18);
  overflow: hidden;                    /* keeps the rounded corners honest */
}

.ts-picker-head {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
}

.ts-picker-head input { flex: 1 1 auto; min-width: 0; }

.ts-picker-list {
  overflow-y: auto;
  padding: 0.2rem 0.9rem 1rem;
}

/* Each field is one block: label above, control below, even spacing between. */
.ts-pick-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 1.1rem 0 0.5rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.ts-pick-head:first-child { margin-top: 0.8rem; }
.ts-pick-count { text-transform: none; letter-spacing: 0; font-weight: 400; opacity: 0.75; }

.ts-pick-opts { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.ts-pick {
  background: var(--field);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 0.34rem 0.8rem;
  font-size: 0.85rem;
  line-height: 1.25;
  cursor: pointer;
  white-space: nowrap;
}

.ts-pick:hover { border-color: var(--blue); }

.ts-pick.on {
  background: rgba(47, 180, 240, 0.14);
  border-color: var(--blue);
  color: var(--text);
  font-weight: 600;
}

/* Free-text classifier: starts as one line, grows a line when the text wraps.
   NOTE the flex reset — the global `input { flex: 1 1 150px }` resolves to a
   150px HEIGHT inside this column-direction flex container. */
.ts-pick-text {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 1.1rem 0 0;
}

.ts-pick-label {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.ts-pick-text .ts-grow {
  flex: 0 0 auto;
  width: 100%;
  min-height: 0;
  padding: 0.45rem 0.6rem;
  background: var(--field);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.45;
  resize: none;                        /* it sizes itself */
  overflow: hidden;                    /* no inner scrollbar; the box grows */
}

.ts-pick-text .ts-grow:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(47, 180, 240, 0.18);
}

.ts-picker-foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 0.9rem;
  border-top: 1px solid var(--border);
  background: var(--row-head);
}

/* ------------------------------------------- tracker bar classifier fields */
.timer-fields { display: inline-flex; gap: 0.4rem; }

.timer-field { min-width: 9.5rem; }

/* Master ID / Work Category badge on tracker entry rows */
.entry-master {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-right: 0.5rem;
}

.entry-master b { color: var(--pink); font-weight: 600; }

.entry-cat {
  font-size: 0.76rem;
  color: var(--muted);
  border-left: 1px solid var(--border);
  padding-left: 0.4rem;
}

/* --------------------------------- reports: pinned Master ID / Work Category */
.primary-filters { display: inline-flex; gap: 0.4rem; flex-wrap: wrap; }

.primary-filters select {
  min-width: 11rem;
  border-color: var(--border);
}

.primary-filters select:not([value=""]) { border-color: var(--blue); }

@media (max-width: 900px) {
  .timer-fields { display: flex; width: 100%; }
  .timer-field { flex: 1; min-width: 0; }
}

/* Reports: the always-visible primary filter row (Master ID / Work Category).
   app.directors.js folds the rest of the filter bar into an "Advanced"
   disclosure; these two never hide, because they are how the product is read. */
.rep-primary-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin: 0.6rem 0 0.4rem;
}

.rep-primary-row .flt-search { flex: 1 1 14rem; min-width: 12rem; }

/* ------------------------------------------------------- templates + editing */
.ts-tpl { display: inline-flex; align-items: center; gap: 0.4rem; }
.ts-tpl select { min-width: 12rem; }

/* A row's classifiers are editable: they must look it. */
.ts-edit {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.15rem 0.35rem;
  margin: -0.15rem -0.35rem;
  border: 1px solid transparent;
  border-radius: 5px;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.ts-edit:hover { border-color: var(--border); background: var(--hover); }
.ts-edit:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

.ts-edit .ts-pencil {
  font-size: 0.72rem;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.12s ease;
}

.ts-row:hover .ts-pencil, .ts-edit:focus .ts-pencil { opacity: 1; }

/* Off-screen but still a real, fillable field — password managers ignore
   display:none inputs, so the username hint on the 2FA form is hidden this way. */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Free-text classifiers in the row picker (Project/Milestone ref, Issue summary) */
.ts-pick-text { display: flex; flex-direction: column; gap: 0.25rem; margin-top: 0.3rem; }

.ts-pick-label {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ts-pick-text input { width: 100%; }

/* Admin → Field schema: reorder controls */
.schema-move { padding: 0.15rem 0.4rem; line-height: 1; font-size: 0.72rem; }


/* A row the user just tried to re-add. Flashed rather than permanently marked:
   it is a pointer ("this is the one you mean"), not a state. */
.ts-row.ts-flash > td {
  background: #fff8e1;
  box-shadow: inset 0 0 0 9999px rgba(255, 196, 0, 0.14);
  transition: background 220ms ease-out, box-shadow 220ms ease-out;
}
@media (prefers-reduced-motion: reduce) {
  .ts-row.ts-flash > td { transition: none; }
}
