/* Work area: work orders, the schedule, recurring work, todos, notes and vendor orders.
   Builds on tasktracker.css; only what that stylesheet doesn't already draw. */

.assign-chip:has(input:checked) {
  border-color: var(--carbon);
  background: var(--carbon-wash);
}

.sheet-work {
  border-top-color: var(--carbon);
}

.checklist form {
  margin: 0;
}

.visit-list .button_to,
.visit-actions form {
  display: inline;
  margin: 0;
}

/* "See it on the schedule" under a visit's day: opens the board on that day. */
.visit-day-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  font-size: 13.5px;
}

.page-actions form.button_to {
  display: inline-flex;
}

/* ----- schedule: the TMXIO calendar drawn like the paper board */

.schedule-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  color: var(--ink-3);
  font-size: 13px;
}

.schedule-tools .input {
  width: auto;
}

/* The picker that replaces these selects copies their width, so leave room for the
   arrow beside the longest choice. */
#dispatch-slot {
  min-width: 140px;
}

#dispatch-layout {
  min-width: 190px;
}

.schedule-tools .muted {
  margin-left: auto;
}

.unscheduled h2 {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 17px;
}

.unscheduled .backlog-item {
  cursor: grab;
  text-align: left;
}

.tt-board,
.unscheduled .backlog-item {
  -webkit-user-select: none;
  user-select: none;
}

.tt-board.tx {
  --tx-font: inherit;
  --tx-fg: var(--ink);
  --tx-border: var(--steel-2);
  --tx-border-muted: var(--steel-2);
  --tx-now: var(--danger, #c0392b);
  --tx-nonbiz: rgb(91 106 111 / 0.07);
  min-width: 640px;
  font-size: 13px;
}

.tt-board .tx-view {
  border: 0;
}

/* See-through, so the hour lines still show across today's column. */
.tt-board .tx-day-today {
  background: rgb(255 220 40 / 0.15);
}

/* Week with people in columns: each date spans every person, so keep the date in view
   at the left of its span instead of centred off screen. */
.tt-board .tx-tg-head-row:not(.tx-resource-row) .tx-col-header {
  overflow: visible;
  text-align: left;
}

.tt-board .tx-tg-head-row:not(.tx-resource-row) .tx-col-header-text {
  display: inline-block;
  position: sticky;
  left: calc(var(--tx-axis-w) + 8px);
}

/* Day names in the week of rows sit centred over their day, as the other headers do. */
.tt-board .tx-tl-slot-row .tx-tl-head-cell {
  text-align: center;
}

/* Rows are tall enough for a card's time, work and customer; month cells hold one line. */
.tt-board .tx-view-timeline {
  --tx-ev-h: 52px;
}

.tt-board .tx-view-daygrid {
  --tx-ev-h: 20px;
}

/* The board's height follows its content, so month weeks need a height of their own.
   The calendar sets each week's min-height to fit its events, which still wins when larger. */
.tt-board .tx-daygrid-month .tx-row {
  flex-basis: 100px;
}

/* The timeline's grid is only as wide as the board unless told to fit its tracks, and
   then the sticky names scroll away with the hours once the board scrolls past that. */
.tt-board .tx-tl-inner {
  width: max-content;
}

/* People in columns: each column stays wide enough to read, and the board scrolls sideways.
   The rows are made as wide as their columns, so the hour lines run the full width. */
.tt-board .tx-tg-head-row,
.tt-board .tx-tg-body {
  grid-template-columns: var(--tx-axis-w) repeat(var(--tx-cols), minmax(130px, 1fr));
}

.tt-board .tx-tg-head,
.tt-board .tx-tg-body {
  min-width: calc(var(--tx-axis-w) + var(--tx-cols) * 130px);
}

/* The times down the side stay put while the board scrolls sideways. */
.tt-board .tx-tg-axis,
.tt-board .tx-tg-head-row > .tx-axis-cell {
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--tx-bg, white);
}

.tt-board .tt-card {
  --who: var(--carbon);
  overflow: hidden;
  height: calc(100% - 2px);
  margin: 1px 2px;
  padding: 3px 6px 3px 7px;
  border: 0;
  border-left: 3px solid var(--who);
  border-radius: 3px;
  background: color-mix(in srgb, var(--who) 13%, white);
  color: var(--ink);
  line-height: 1.25;
  cursor: pointer;
}

/* The visit a work order's "See it on the schedule" came for. */
.tt-board .tt-card.tt-focus {
  outline: 2px solid var(--who, var(--carbon));
  outline-offset: 1px;
}

.tt-board .tt-card > * {
  color: inherit;
}

.tt-board .tt-card .tx-event-inner {
  align-items: flex-start;
  padding: 0;
}

.tt-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.tt-card-body > * {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tt-card-time {
  color: var(--ink-3);
  font-size: 12px;
}

.tt-card-body small {
  color: var(--ink-3);
}

.tt-board .tt-card.tt-completed {
  background-image: repeating-linear-gradient(135deg, transparent 0 6px, rgb(255 255 255 / 0.55) 6px 12px);
}

/* Tentative: the time isn't agreed with the customer yet. Faded, with a dashed edge. */
/* An outline, not a border, so the card keeps its size and its resize handle stays put. */
.tt-board .tt-card.tt-tentative {
  border-left-style: dashed;
  outline: 1px dashed var(--who);
  outline-offset: -1px;
  background: color-mix(in srgb, var(--who) 6%, white);
}

.schedule-tentative-swatch {
  width: 14px;
  height: 10px;
  border: 1px dashed var(--ink-3);
  border-radius: 2px;
}

.tt-board .tt-card.tt-event {
  background: #fff6cc;
  border-left-style: dashed;
}

.tt-board .tt-month {
  display: block;
  padding: 1px 5px;
}

.tt-board .tt-month .tt-card-body {
  flex-direction: row;
  gap: 4px;
}

.tt-board .tt-month .tt-card-time {
  flex: none;
  overflow: visible;
}

.tt-board .tt-month .tt-card-body strong {
  font-weight: 500;
}

.dispatch-resource {
  padding: 4px 2px;
  line-height: 1.25;
}

.dispatch-resource-name {
  font-weight: 600;
}

.dispatch-resource-hours,
.dispatch-resource-sync {
  color: var(--ink-3);
  font-size: 12px;
}

.dispatch-resource-overtime,
.dispatch-resource-sync-stale {
  color: var(--warn);
}

.dispatch-results {
  max-height: 200px;
  margin: 6px 0 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.dispatch-results button {
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.dispatch-results button:hover {
  background: var(--steel);
}

/* Past work like this (org/related_work_orders): the short list on a work order and the full history. */
.related-intro {
  margin-bottom: 8px;
}

.related-brief small {
  display: block;
}

.related-label {
  margin: 8px 0 0;
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.related-visits p {
  margin-top: 2px;
}

.related-print {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.related-print .row {
  flex-wrap: wrap;
  gap: 8px 18px;
}
