/* ============================================================
   Tickets — with the driver, back from the driver, handed in.
   The Tickets page and the three ticket forms. Prefix tk-.
   ============================================================ */

/* [hidden] loses to display rules on .field-row and friends. */
.tk-page [hidden], .tk-form [hidden] { display: none !important; }

.tk-sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; margin: -1px; padding: 0; border: 0;
}

.tk-month-pick select.input { width: auto; min-width: 170px; }
.tk-drivers { margin-top: 6px; }
.tk-driver-line { font-size: 14px; font-weight: 600; color: var(--black); }
.tk-driver-line + .tk-driver-line { margin-top: 2px; }

/* ── the three steps ────────────────────────────────────────────── */

.tk-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}
.tk-step {
  position: relative;
  background: var(--gray-soft);
  border: 1px solid var(--gray-border);
  border-top: 3px solid var(--gray-border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}
.tk-step-with_driver { border-top-color: var(--gray-muted-text); }
.tk-step-returned    { border-top-color: hsl(var(--primary)); }
.tk-step-handed_in   { border-top-color: var(--success); }

/* An arrow into the next step. */
.tk-step + .tk-step::before {
  content: "";
  position: absolute;
  left: calc(-1 * var(--space-lg) / 2 - 5px);
  top: 50%;
  width: 10px; height: 10px;
  border: solid var(--gray-muted-text);
  border-width: 2px 2px 0 0;
  transform: translateY(-50%) rotate(45deg);
}

.tk-step-label {
  font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: hsl(var(--muted-foreground));
}
.tk-step-count {
  font-size: 34px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1;
  margin-top: var(--space-sm); color: var(--black);
}
.tk-step-count span { font-size: 15px; font-weight: 500; letter-spacing: 0; color: hsl(var(--muted-foreground)); }
.tk-step-sub { font-size: 13px; color: hsl(var(--muted-foreground)); margin-top: var(--space-xs); }
.tk-loading .tk-step-count { color: var(--gray-border); }

/* ── what needs chasing ─────────────────────────────────────────── */

.tk-chase {
  background: var(--warning-tint);
  border: 1px solid var(--warning-line);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-lg);
}
.tk-chase-title {
  font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--warning-ink); padding: var(--space-xs) 0;
}
.tk-chase-line {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-md);
  padding: var(--space-sm) 0;
  border-top: 1px solid var(--warning-line);
  flex-wrap: wrap;
}
.tk-chase-title + .tk-chase-line { border-top: 0; }
.tk-chase-text { font-size: 14.5px; font-weight: 600; color: var(--warning-ink); }
.tk-chase-line .btn { background: var(--white); }

/* ── stubs, coloured by stage ───────────────────────────────────── */

.tk-stubs { margin-bottom: var(--space-sm); }
.stub.tk-stub-with_driver, .tk-legend-swatch.tk-stub-with_driver {
  background: transparent;
  border: 1.5px dashed var(--gray-muted-text);
}
.stub.tk-stub-returned, .tk-legend-swatch.tk-stub-returned { background: hsl(var(--primary)); border: 0; }
.stub.tk-stub-handed_in, .tk-legend-swatch.tk-stub-handed_in { background: var(--success); border: 0; }

.tk-legend {
  display: flex; flex-wrap: wrap; gap: var(--space-md);
  font-size: 12.5px; color: hsl(var(--muted-foreground));
  margin-bottom: var(--space-lg);
}
.tk-legend:empty { display: none; }
.tk-legend-key { display: inline-flex; align-items: center; gap: 6px; }
.tk-legend-swatch { width: 10px; height: 14px; border-radius: 3px; display: inline-block; }

.tk-empty-inline { padding: var(--space-md) 0; text-align: left; }
.tk-link { color: var(--cyan-ink); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* ── register ───────────────────────────────────────────────────── */

.tk-table { min-width: 860px; }
.tk-table .tk-no { font-weight: 700; white-space: nowrap; }
.tk-table td { white-space: nowrap; }
.tk-cell-sub { font-size: 11.5px; color: hsl(var(--muted-foreground)); margin-top: 2px; }
.tk-cell-sub.tk-late { color: var(--danger-ink); font-weight: 600; }
.modal-actions .tk-delete { margin-right: auto; }

/* ── forms ──────────────────────────────────────────────────────── */

.tk-form .tk-date { max-width: 220px; min-height: 48px; }
.tk-form .tk-number { min-height: 48px; font-size: 17px; font-weight: 600; }
.tk-optional { font-weight: 500; text-transform: none; letter-spacing: 0; }

.tk-preview { margin-top: var(--space-sm); }
.tk-preview .form-alert { margin: var(--space-sm) 0 0; }
.tk-preview-empty { font-size: 13.5px; color: hsl(var(--muted-foreground)); padding: var(--space-xs) 0; }
.tk-preview-count { font-size: 15px; }
.tk-preview-count strong { font-weight: 700; }
.tk-preview-stubs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: var(--space-sm); }
.tk-mini-stub {
  width: 12px; height: 18px; border-radius: 3px;
  border: 1.5px dashed var(--gray-muted-text);
}
.tk-mini-stub.is-used { background: var(--warning); border: 0; }

/* Big tick rows: one per ticket, the whole row is the tap target. */
.tk-tick-list { display: flex; flex-direction: column; gap: var(--space-sm); }
.tk-tick-group {
  font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: hsl(var(--muted-foreground)); margin-top: var(--space-sm);
}
.tk-tick-group:first-child { margin-top: 0; }
.tk-tick {
  border: 1px solid var(--gray-border);
  border-radius: var(--radius-md);
  background: var(--white);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.tk-tick.is-on { border-color: var(--accent-strong); box-shadow: 0 0 0 1px var(--accent-line); }
.tk-tick-row {
  display: flex; align-items: center; gap: var(--space-md);
  min-height: 56px;
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  user-select: none;
}
.tk-tick-box {
  width: 24px; height: 24px; flex-shrink: 0;
  accent-color: var(--black);
  cursor: pointer;
  margin: 0;
}
.tk-tick-no { font-size: 17px; font-weight: 700; }
.tk-tick-meta { font-size: 13px; color: hsl(var(--muted-foreground)); margin-left: auto; text-align: right; }
.tk-tick-extra {
  padding: 0 var(--space-md) var(--space-sm);
  border-top: 1px solid var(--gray-border);
  padding-top: var(--space-md);
}
.tk-tick-extra .field { margin-bottom: var(--space-sm); }
.tk-tick-extra .input { min-height: 44px; }
.tk-handin-hint { margin: 0 0 var(--space-sm); }

@media (max-width: 900px) {
  .tk-steps { gap: var(--space-md); }
  .tk-step + .tk-step::before { left: calc(-1 * var(--space-md) / 2 - 5px); }
  .tk-step-count { font-size: 28px; }
}

@media (max-width: 560px) {
  .tk-head-actions { width: 100%; }
  .tk-head-actions .btn { flex: 1 1 100%; }
  .tk-month-pick, .tk-month-pick select.input { width: 100%; }
  .tk-steps { grid-template-columns: 1fr; gap: var(--space-md); }
  .tk-step + .tk-step::before {
    left: 50%; top: calc(-1 * var(--space-md) / 2 - 6px);
    transform: translateX(-50%) rotate(135deg);
  }
  .tk-chase-line .btn { width: 100%; min-height: 44px; }
  .tk-form .tk-date { max-width: none; }
  .tk-tick-row { flex-wrap: wrap; }
  .tk-tick-meta { margin-left: 0; text-align: left; flex-basis: 100%; padding-left: 40px; }
}
