/* Page-level styling for the Edit job screen.
   Everything visual traces back to a design-system token — this file only
   carries the few rules the system has no component for (the note textarea,
   the drag handle, the status menu). */

/* The CJK font stack and the :lang(zh) line-height / tracking adjustments now
   live in the design system itself (tokens/fonts.css, tokens/typography.css,
   base.css), so nothing needs overriding here. Only the one rule below, for a
   local class the design system does not know about. */

html, body { margin: 0; padding: 0; }
body { background: var(--color-canvas-soft); -webkit-font-smoothing: antialiased; }

:lang(zh) .tl-status__trigger { letter-spacing: 0; }

/* ── App shell ───────────────────────────────────────────────── */
.tl-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
  background: var(--color-canvas-soft);
  color: var(--color-ink);
}
.tl-rail {
  background: var(--color-canvas);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  position: sticky;
  top: 0;
  height: 100vh;
}
.tl-wordmark {
  display: flex;
  align-items: center;
  padding: 6px var(--space-sm);
  text-decoration: none;
  color: var(--color-ink);
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  font-size: 19px;
  letter-spacing: -.03em;
}
.tl-rail__nav { display: flex; flex-direction: column; gap: var(--space-xxs); }
.tl-rail__user {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm);
}
.tl-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--color-primary-pale);
  font-size: 13px;
  font-weight: var(--weight-strong);
  flex: 0 0 auto;
}

.tl-main-col { display: flex; flex-direction: column; min-width: 0; }
.tl-topbar {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  background: var(--color-canvas);
  padding: var(--space-md) var(--space-xl);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 20;
}
.tl-backlink {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--fs-body-sm);
  line-height: var(--lh-body-sm);
  font-weight: var(--weight-strong);
  color: var(--color-ink);
  text-decoration: none;
}
.tl-spacer { flex: 1; }

/* Segmented language switch — both options stay visible, so a contractor who
   cannot read the current language can still find their way out. */
.tl-langswitch {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: var(--radius-pill);
  background: var(--color-canvas-soft);
  flex: 0 0 auto;
}
.tl-langswitch__btn {
  border: 0;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: var(--fs-body-sm);
  line-height: var(--lh-body-sm);
  font-weight: var(--weight-strong);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-body);
  transition: background-color var(--dur-fast) var(--ease-standard),
              color var(--dur-fast) var(--ease-standard);
}
.tl-langswitch__btn:hover { color: var(--color-ink); }
.tl-langswitch__btn.is-active {
  background: var(--color-canvas);
  color: var(--color-ink);
}

.tl-main {
  padding: var(--space-2xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-2xl);
  min-width: 0;
}
.tl-pagehead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-lg);
  flex-wrap: wrap;
}
.tl-pagehead h1 {
  margin: 6px 0 0;
  font-size: var(--fs-display-sm);
  line-height: var(--lh-display-sm);
  font-weight: var(--weight-strong);
  letter-spacing: var(--ls-display-sm);
}
.tl-columns {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xl);
  align-items: flex-start;
}
.tl-col-main { flex: 1 1 620px; min-width: 0; display: flex; flex-direction: column; gap: var(--space-xl); }
.tl-col-side { flex: 1 1 300px; max-width: 360px; display: flex; flex-direction: column; gap: var(--space-lg); position: sticky; top: 92px; }

.tl-section {
  background: var(--color-canvas);
  border-radius: var(--radius-card);
  padding: var(--card-padding);
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.tl-section--outline { border: 1px solid var(--border-strong); }
.tl-stack-sm { display: flex; flex-direction: column; gap: 6px; }
.tl-stack-md { display: flex; flex-direction: column; gap: var(--space-sm); }
.tl-rule { height: 1px; background: var(--border-subtle); }
.tl-actions { display: flex; gap: var(--space-md); flex-wrap: wrap; align-items: center; }
.tl-muted { font-size: var(--fs-body-sm); line-height: var(--lh-body-sm); color: var(--color-mute); }
.tl-body { font-size: var(--fs-body-sm); line-height: var(--lh-body-sm); color: var(--color-body); }
.tl-heading-display {
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  font-size: var(--fs-display-xs);
  line-height: 30px;
}

/* ── Status pill + menu ──────────────────────────────────────── */
.tl-status { position: relative; }
.tl-status__trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  border-radius: var(--radius-badge);
  padding: var(--space-xs) var(--space-md);
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: var(--fs-body-sm);
  line-height: var(--lh-body-sm);
  font-weight: var(--weight-strong);
  white-space: nowrap;
  transition: box-shadow var(--dur-fast) var(--ease-standard);
}
.tl-status__trigger:hover { box-shadow: inset 0 0 0 1px rgba(20, 27, 31, .18); }
.tl-status__backdrop { position: fixed; inset: 0; z-index: 25; }
.tl-status__menu {
  position: absolute;
  top: calc(100% + var(--space-sm));
  right: 0;
  min-width: 208px;
  background: var(--color-canvas);
  border-radius: var(--radius-lg);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: var(--space-xxs);
  box-shadow: var(--shadow-lg);
  z-index: 30;
}
.tl-status__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: var(--fs-body-sm);
  line-height: var(--lh-body-sm);
  color: var(--color-ink);
}
.tl-status__item:hover { background: var(--color-canvas-soft); }
.tl-status__dot { width: 8px; height: 8px; border-radius: var(--radius-full); flex: 0 0 auto; }

/* ── Stage + step grids ──────────────────────────────────────── */
.tl-scroll-x { overflow-x: auto; display: flex; flex-direction: column; gap: 20px; }
.tl-stage-grid {
  display: grid;
  grid-template-columns: 24px 32px minmax(160px, 1fr) 156px 156px 32px 32px;
  gap: var(--space-md);
  align-items: center;
  min-width: 668px;
}
.tl-step-grid {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 156px 172px 168px 116px 32px;
  gap: var(--space-md);
  align-items: center;
  min-width: 872px;
}

/* Customer-action star. The design system is outline-only, so the on state is
   carried by fill and colour rather than by a solid glyph. */
.tl-star {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  background: var(--color-canvas);
  color: var(--color-mute);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-standard),
              color var(--dur-fast) var(--ease-standard),
              border-color var(--dur-fast) var(--ease-standard);
}
.tl-star:hover { border-color: var(--border-strong); color: var(--color-ink); }
.tl-star.is-on {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--text-on-primary);
}
.tl-star.is-on:hover { background: var(--action-primary-hover); }
/* Grid children default to min-width:auto, which lets a native date input push
   its column past the track size and shove the trailing actions out of view. */
.tl-stage-grid > *,
.tl-step-grid > * { min-width: 0; }
.tl-stage-grid input,
.tl-step-grid input { min-width: 0; }

.tl-grid-head { padding: 0 var(--space-xs); }
.tl-rows { display: flex; flex-direction: column; gap: var(--space-sm); }
.tl-stage-row {
  padding: var(--space-xs);
  border-radius: var(--radius-lg);
  transition: background var(--dur-fast) var(--ease-standard);
}
.tl-step-row { padding: var(--space-xs); }

.tl-drag {
  display: grid;
  place-items: center;
  width: 24px;
  height: 28px;
  cursor: grab;
  color: var(--color-mute);
}
.tl-drag:active { cursor: grabbing; }
.tl-stage-dot {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: var(--weight-strong);
}

/* ── Notes + checklist ───────────────────────────────────────── */
.tl-note {
  font-family: var(--font-sans);
  font-size: var(--fs-body-md);
  line-height: var(--lh-body-md);
  color: var(--color-ink);
  background: var(--color-canvas);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-input);
  padding: var(--space-md) var(--space-lg);
  width: 100%;
  resize: vertical;
}
.tl-note::placeholder { color: var(--color-mute); }
.tl-note:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--color-primary-pale); }

.tl-check {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  cursor: pointer;
  padding: var(--space-sm);
  border-radius: var(--radius-md);
  margin: 0 calc(var(--space-sm) * -1);
}
.tl-check:hover { background: var(--color-canvas-soft); }
.tl-check input {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.tl-empty {
  background: var(--color-canvas-soft);
  border-radius: var(--radius-lg);
  padding: var(--card-padding);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── Summary card rows ───────────────────────────────────────── */
.tl-kv {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
}
.tl-kv__value {
  font-size: var(--fs-body-md);
  line-height: var(--lh-body-md);
  font-weight: var(--weight-strong);
  font-variant-numeric: tabular-nums;
}
.tl-kv__value--display {
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  font-size: var(--fs-display-xs);
  line-height: 30px;
}

@media (max-width: 900px) {
  .tl-shell { grid-template-columns: minmax(0, 1fr); }
  .tl-rail { display: none; }
  .tl-main { padding: var(--space-lg); }
  .tl-col-side { position: static; max-width: none; }
}
