/* Contracts, pay rates and time forms (3.1). Tokens from app.css only. No horizontal scrolling: rate rows and time
   form lines are grids that wrap their fields onto more rows as the space narrows, so phones get stacked fields. */

.ct-js { display: none; }
.js .ct-js { display: inline-flex; }

/* contract types */
.ct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: var(--s4); }
.ct-card { display: block; color: inherit; text-decoration: none; transition: border-color .15s; }
.ct-card:hover { text-decoration: none; border-color: var(--border-strong); }
.ct-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ct-name { font-size: 16px; margin: 0; overflow-wrap: anywhere; }
.ct-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2) var(--s4); margin: 0; }
.ct-facts dt { font-size: 12px; color: var(--muted); }
.ct-facts dd { margin: 0; font-weight: 500; font-size: 13.5px; overflow-wrap: anywhere; }
details.ct-new > summary, details.card > summary.card-head { cursor: pointer; list-style: none; }
details.card > summary.card-head::-webkit-details-marker { display: none; }
details.card:not([open]) > summary.card-head { border-bottom: 0; }
.ct-check { align-self: end; min-height: 40px; }

.ct-rates { display: grid; gap: var(--s2); }
.ct-rate { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.3fr) repeat(3, minmax(0, 1fr)); gap: var(--s2); align-items: end; }
.ct-rate-head { font-size: 12px; color: var(--muted); font-weight: 600; }
.ct-cell { display: grid; gap: 2px; min-width: 0; }
.ct-cell .input { width: 100%; min-width: 0; }
.ct-lab { display: none; font-size: 12px; color: var(--muted); }
.ct-rate-list li { gap: var(--s3); }
.ct-rate-list strong { white-space: nowrap; }
@media (max-width: 760px) {
  .ct-rate-head { display: none; }
  .ct-rate { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: var(--s3); border: 1px solid var(--border); border-radius: var(--r); }
  .ct-rate .ct-cell:first-of-type { grid-column: 1 / -1; }
  .ct-lab { display: block; }
}

/* time forms */
.tc-lines { display: grid; gap: var(--s2); }
.tc-line { display: grid; grid-template-columns: repeat(auto-fit, minmax(124px, 1fr)); gap: var(--s2); align-items: end;
  padding: var(--s3); border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); }
.tc-line .tc-wide { grid-column: span 2; }
.tc-line .tc-note { grid-column: span 2; }
.tc-cell { display: grid; gap: 2px; min-width: 0; }
.tc-cell .input { width: 100%; min-width: 0; }
.tc-lab { font-size: 11.5px; color: var(--muted); font-weight: 500; }
@media (max-width: 380px) { .tc-line .tc-wide, .tc-line .tc-note { grid-column: auto; } }
.tc-copy { margin-top: var(--s2); }
.tc-save[data-tone="error"] { color: var(--danger); }
.tc-save[data-tone="ok"] { color: var(--good); }

.tc-days { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.tc-daychip { display: grid; justify-items: center; gap: 2px; padding: 6px 2px; border-radius: var(--r-sm); background: var(--surface-2);
  font-size: 11.5px; color: var(--muted); }
.tc-daychip strong { font-size: 13px; color: var(--text); font-variant-numeric: tabular-nums; }
.tc-daychip.on { background: var(--info-soft); }
.tc-flags { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tc-flag { font-size: 12.5px; line-height: 1.4; padding: 6px 10px; border-radius: var(--r-sm); background: var(--info-soft); }
.tc-flag.warn { background: var(--warn-soft); }
.tc-review-row { display: grid !important; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s2) var(--s3); align-items: center; }
.tc-review-row .tc-flags { grid-column: 1 / -1; }
.tc-period { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: end; }
.tc-period .field { min-width: 150px; }
