/* public/css/jobs/finish-schedule.css
 *
 * Job-detail "Finish Schedule" sub-tab (js/jobs/finish-schedule.js).
 * Namespaced .fsched-*; JMD theme tokens throughout (serif-first inherits from
 * the app shell; DisplayMaterial dominant, call-out code small/muted).
 * Mobile: rows stack, tap targets >= 44px, no horizontal scroll.
 * PDF viewing uses the shared JMD viewer (css/jmd-pdf-viewer.css).
 */

/* ─── Header row ─────────────────────────────────────────────────────── */
.fsched-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.fsched-head-main { min-width: 0; }
.fsched-head .j-tab-h2 { word-break: break-word; }
.fsched-refresh { flex-shrink: 0; transition: transform .12s ease, filter .15s ease; }
.fsched-refresh:active { transform: scale(.96); }
.fsched-refresh svg { width: 15px; height: 15px; }
.fsched-parse-warn { color: var(--danger, #B3402A); font-weight: 600; }

/* ─── Unmatched-PDF banner (amber) ───────────────────────────────────── */
.fsched-banner {
  border: 1px solid var(--warning, #B98A2E);
  background: var(--warning-bg, rgba(185, 138, 46, .10));
  border-radius: var(--r-md, 8px);
  padding: 12px 14px; margin: 0 0 16px;
  animation: fschedBannerIn .32s cubic-bezier(.22,.9,.34,1) both;
}
@keyframes fschedBannerIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
/* Everything inside the banner sits on the amber tint — always use the warning
   foreground tone, never --text-primary (illegible on the light-theme cream). */
.fsched-banner-title {
  font-weight: 700; color: var(--warning-fg, #845E08);
  font-size: var(--fs-sm, 13px); margin-bottom: 8px;
}
.fsched-banner-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--warning, #B98A2E);
}
.fsched-banner-file {
  font-weight: 600; font-size: var(--fs-sm, 13px); color: var(--warning-fg, #845E08);
  word-break: break-word; min-width: 0;
}
.fsched-banner-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fsched-mini-btn { min-height: 44px; padding: 8px 14px; }
.fsched-banner .j-btn-ghost { color: var(--warning-fg, #845E08); border-color: var(--warning, #B98A2E); }
.fsched-assign-sel {
  min-height: 44px; padding: 8px 10px; border-radius: var(--r-md, 8px);
  border: 1px solid var(--border-color); background: var(--bg-card);
  color: var(--text-primary); font-family: inherit; font-size: var(--fs-sm, 13px);
  max-width: 240px;
}

/* ─── Sections ────────────────────────────────────────────────────────── */
.fsched-section { margin: 0 0 20px; }
.fsched-section-hd {
  display: flex; align-items: center; gap: 8px;
  font-size: var(--fs-overline, 11px); font-weight: 700;
  letter-spacing: var(--tr-overline, .12em); text-transform: uppercase;
  color: var(--text-muted); padding: 6px 2px; margin-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
}
.fsched-sheet-tag {
  font-size: var(--fs-caption, 11px); font-weight: 700; letter-spacing: .04em;
  padding: 1px 8px; border-radius: var(--r-full, 999px);
  border: 1px solid var(--border-color); background: var(--bg-tertiary);
  color: var(--text-secondary); text-transform: none;
}

/* ─── Call-out rows ──────────────────────────────────────────────────── */
.fsched-row {
  background: var(--bg-card);
  border: 1px solid var(--border-color); border-radius: var(--r-md, 8px);
  margin-bottom: 6px; box-shadow: var(--shadow-sm);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.fsched-row:hover { border-color: var(--border-strong, var(--border-color)); }
.fsched-row.open { box-shadow: var(--shadow-md, 0 4px 14px rgba(8,27,22,.10)); }
.fsched-row-main {
  display: grid; grid-template-columns: 76px 1fr auto auto auto; align-items: center;
  gap: 12px; width: 100%; min-height: 52px; padding: 10px 14px;
  background: none; border: none; cursor: pointer; text-align: left;
  font-family: inherit; color: var(--text-primary);
  transition: filter .15s ease;
}
.fsched-row-main:hover { filter: brightness(1.02); }
.fsched-row-main:focus-visible { outline: 2px solid var(--accent-cyan, #2B7A78); outline-offset: -2px; border-radius: var(--r-md, 8px); }
.fsched-co-code {
  font-size: var(--fs-sm, 13px); color: var(--text-muted);
  font-variant-numeric: tabular-nums; font-weight: 600;
  /* Long call-outs (DRAWER BOXES, SHELF PINS…) must WRAP inside the fixed
     column — nowrap here overflowed into the description column. */
  white-space: normal; overflow-wrap: anywhere; line-height: 1.25;
  min-width: 0;
}
.fsched-co-body { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.fsched-co-material {
  font-size: var(--fs-body-lg, 17px); font-weight: 700; line-height: 1.25;
  color: var(--text-primary); word-break: break-word;
}
.fsched-co-finish { font-size: var(--fs-sm, 13px); color: var(--text-secondary); word-break: break-word; }
.fsched-co-status { justify-self: end; }
.fsched-chevron {
  width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0;
  transition: transform .22s cubic-bezier(.22,.9,.34,1);
}
.fsched-row.open .fsched-chevron { transform: rotate(180deg); }

/* Linked-submittal buttons — INLINE grid items on the header line (normal flow,
   so an expanded row can never be covered; the old absolute placement floated
   over the detail fields). */
.fsched-row-pdfs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.fsched-pdf-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 8px 14px; border-radius: var(--r-md, 8px);
  border: 1px solid var(--accent-cyan, #2B7A78); background: var(--bg-tertiary);
  color: var(--accent-cyan, #2B7A78); cursor: pointer;
  font-family: inherit; font-size: var(--fs-sm, 13px); font-weight: 700;
  white-space: nowrap;
  transition: filter .15s ease, transform .12s ease, box-shadow .18s ease;
}
.fsched-pdf-btn:hover { filter: brightness(1.06); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.fsched-pdf-btn:active { transform: scale(.96); }
.fsched-pdf-btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.fsched-pdf-btn-label { line-height: 1; }

/* ─── Status chips ────────────────────────────────────────────────────── */
.fsched-chip {
  display: inline-flex; align-items: center; padding: 3px 10px;
  border-radius: var(--r-full, 999px); font-size: var(--fs-caption, 12px);
  font-weight: 700; white-space: nowrap; border: 1px solid var(--border-color);
  transition: filter .15s ease;
}
.fsched-chip-app   { color: var(--success-fg, #1B5740); background: var(--success-bg, #E7F2EC); border-color: var(--success, #2E7D5B); }
.fsched-chip-san   { color: var(--warning-fg, #845E08); background: var(--warning-bg, #FBF2D2); border-color: var(--warning, #B98A2E); }
.fsched-chip-needs { color: var(--danger, #B3402A); background: var(--danger-bg, rgba(179,64,42,.10)); border-color: var(--danger, #B3402A); }
.fsched-chip-none,
.fsched-chip-other { color: var(--text-muted); background: var(--bg-tertiary); }

/* ─── Expanded detail (fields[]) — animated height via grid rows ─────── */
.fsched-detail {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows .28s cubic-bezier(.22,.9,.34,1);
}
.fsched-row.open .fsched-detail { grid-template-rows: 1fr; }
.fsched-detail-inner {
  overflow: hidden; min-height: 0;
  padding: 0 14px; opacity: 0; transform: translateY(-4px);
  transition: opacity .22s ease .05s, transform .22s ease .05s, padding .28s cubic-bezier(.22,.9,.34,1);
}
.fsched-row.open .fsched-detail-inner {
  padding: 4px 14px 12px; opacity: 1; transform: none;
  border-top: 1px solid var(--border-color);
}
.fsched-field {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding: 6px 0; border-bottom: 1px solid var(--border-color);
}
.fsched-field:last-child { border-bottom: none; }
.fsched-field-label {
  font-size: var(--fs-caption, 12px); font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .05em; flex: 0 0 auto;
}
.fsched-field-value {
  font-size: var(--fs-sm, 13px); color: var(--text-primary); font-weight: 600;
  text-align: right; min-width: 0; word-break: break-word;
}

/* ─── Empty state ─────────────────────────────────────────────────────── */
.fsched-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.fsched-empty-title { font-size: var(--fs-body-lg, 17px); font-weight: 700; color: var(--text-secondary); }
.fsched-empty-sub { font-size: var(--fs-sm, 13px); color: var(--text-muted); max-width: 420px; text-align: center; }

/* ─── Mobile ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .fsched-head { flex-direction: column; align-items: stretch; }
  .fsched-refresh { align-self: flex-start; }
  .fsched-banner-row { flex-direction: column; align-items: stretch; }
  .fsched-banner-actions { justify-content: stretch; min-width: 0; }
  /* width:100% + min-width:0 — otherwise the select's intrinsic width (its
     longest option text) overflows the banner on narrow screens */
  .fsched-assign-sel { flex: 1; max-width: none; width: 100%; min-width: 0; }
  .fsched-row-main {
    grid-template-columns: 1fr auto auto; grid-auto-rows: auto;
    row-gap: 6px; padding: 12px;
  }
  .fsched-co-code { grid-row: 1; grid-column: 1; }
  .fsched-co-body { grid-row: 2; grid-column: 1 / -1; }
  .fsched-co-status { grid-row: 1; grid-column: 2; }
  .fsched-chevron { grid-row: 1; grid-column: 3; }
  .fsched-row-pdfs { grid-row: 3; grid-column: 1 / -1; justify-content: stretch; }
  .fsched-pdf-btn { flex: 1; justify-content: center; }
  .fsched-field { flex-direction: column; gap: 2px; align-items: flex-start; }
  .fsched-field-value { text-align: left; }
}

/* ─── Reduced motion ─────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .fsched-banner { animation: none; }
  .fsched-chevron, .fsched-detail, .fsched-detail-inner,
  .fsched-row, .fsched-pdf-btn, .fsched-refresh { transition: none; }
}
