/* ============================================================
   Job duties library — Settings panel, the duty-line editor, and the
   auto-fill provenance line that appears under a duties box.

   House palette and type only; no new tokens, no new fonts. Mobile-first:
   every row is a single column at 390px and nothing may scroll sideways —
   the duty lines are long sentences, so every one of them is allowed to
   wrap and none of them is allowed to widen its parent.
   ============================================================ */

.jd-panel { margin-top: 18px; }
.jd-panel.jd-flash {
  animation: jdFlash 1.4s ease;
}
@keyframes jdFlash {
  0%, 100% { box-shadow: none; }
  25%      { box-shadow: 0 0 0 3px rgba(169, 130, 76, .35); }
}

.jd-intro {
  font-size: 13px;
  line-height: 1.6;
  margin: 2px 0 14px;
  max-width: 66ch;
}

/* ---------- toolbar ---------- */

.jd-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.jd-search { flex: 1 1 220px; min-width: 0; }
.jd-search input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--stroke);
  border-radius: var(--r-sm);
  background: var(--paper);
  outline: none;
}
.jd-search input:focus { border-color: var(--gold); }
.jd-toolbar-btns { display: flex; gap: 8px; flex: 0 0 auto; flex-wrap: wrap; }
.jd-toolbar-btns .btn.on { border-color: var(--gold); color: var(--gold-deep); }

/* ---------- list ---------- */

.jd-body { min-width: 0; }

.jd-section-lbl {
  font-size: 10.5px;
  letter-spacing: .09em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--gold-deep);
  margin: 14px 0 8px;
}
.jd-section-lbl:first-child { margin-top: 0; }
.jd-section-seed { color: var(--ink-faint); }

.jd-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border: 1px solid var(--stroke-soft);
  border-radius: var(--r-sm);
  background: var(--paper);
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
  min-width: 0;
}
.jd-row:hover { border-color: var(--gold); background: var(--bone); }
.jd-row-seed { cursor: default; background: var(--bone); }
.jd-row-seed:hover { border-color: var(--stroke-soft); }

.jd-row-main { flex: 1 1 auto; min-width: 0; }
.jd-row-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}
.jd-row-title {
  font-family: var(--disp);
  font-weight: 600;
  font-size: 14.5px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.jd-row-preview {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.jd-more { color: var(--gold-deep); font-weight: 600; }
.jd-row-meta {
  font-size: 11.5px;
  color: var(--ink-faint);
  margin-top: 4px;
  overflow-wrap: anywhere;
}
.jd-row-go { flex: 0 0 auto; color: var(--ink-faint); display: flex; align-items: center; gap: 6px; }
.jd-row-go svg { width: 16px; height: 16px; }

.jd-empty {
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-soft);
  padding: 16px 14px;
  border: 1px dashed var(--stroke);
  border-radius: var(--r-sm);
  background: var(--bone);
}
.jd-empty-sm { padding: 12px; font-size: 12.5px; }
.jd-empty-bad { color: var(--red); border-color: var(--red); background: rgba(140, 59, 46, .05); }

/* ---------- provenance badges ----------
   The whole point of the feature: a consultant must be able to tell the
   firm's own contract wording from a placeholder at a glance, because only
   one of the two may go onto a signed agreement unread. */

.jd-badge {
  display: inline-block;
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
  line-height: 1.6;
}
.jd-badge-firm { background: rgba(30, 58, 51, .10); color: var(--green); }
.jd-badge-seed { background: rgba(169, 130, 76, .14); color: var(--gold-deep); white-space: normal; }
.jd-badge-none { background: var(--bone-2); color: var(--ink-faint); }
.jd-badge-off  { background: rgba(140, 59, 46, .10); color: var(--red); }

.jd-seedwarn {
  font-size: 12.5px;
  line-height: 1.55;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: rgba(169, 130, 76, .12);
  border: 1px solid rgba(169, 130, 76, .32);
  margin-bottom: 14px;
}

/* ---------- the duty-line editor ---------- */

/* `.hint` is only styled inside `.panel-title` in styles.css, so a
   standalone one renders at full body weight. Given its own size here
   rather than reaching into the shared rule. */
.jd-keyhint {
  margin: -4px 0 14px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-faint);
  max-width: 68ch;
}
.jd-field .jd-field-head .hint {
  font-family: var(--body);
  font-weight: 500;
  font-size: 12px;
  color: var(--ink-faint);
  letter-spacing: .04em;
}

.jd-lines-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.jd-lines-head label {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
}

.jd-lines {
  border: 1px solid var(--stroke-soft);
  border-radius: var(--r-sm);
  padding: 8px;
  background: var(--bone);
  max-height: 46vh;
  overflow-y: auto;
  min-width: 0;
}

.jd-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 7px;
  min-width: 0;
}
.jd-line:last-child { margin-bottom: 0; }

.jd-line-n {
  flex: 0 0 22px;
  text-align: right;
  font-family: var(--disp);
  font-weight: 700;
  font-size: 12px;
  color: var(--gold);
  padding-top: 9px;
}
.jd-line-in {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  /* height is set from scrollHeight by autosize() in jobduties.js — a
     fixed rows= clips a full-sentence duty at 390px. */
  resize: none;
  overflow: hidden;
  padding: 7px 9px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: var(--paper);
  line-height: 1.5;
  font-size: 13.5px;
  outline: none;
}
.jd-line-in:focus { border-color: var(--gold); }
.jd-line-in[readonly] { background: var(--bone-2); }

.jd-line-btns { flex: 0 0 auto; display: flex; flex-direction: column; gap: 3px; }
.jd-mini {
  width: 26px; height: 22px;
  border: 1px solid var(--stroke);
  background: var(--paper);
  border-radius: 6px;
  font-size: 12px;
  line-height: 1;
  color: var(--ink-soft);
}
.jd-mini:hover:not(:disabled) { border-color: var(--gold); color: var(--gold-deep); }
.jd-mini:disabled { opacity: .3; cursor: default; }
.jd-mini-del:hover { border-color: var(--red); color: var(--red); }

.jd-lines-foot { display: flex; gap: 8px; margin: 10px 0 14px; flex-wrap: wrap; }

.jd-paste { margin-bottom: 14px; }
.jd-paste textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--stroke);
  border-radius: var(--r-sm);
  background: var(--paper);
  line-height: 1.55;
  margin-bottom: 8px;
  outline: none;
}
.jd-paste textarea:focus { border-color: var(--gold); }

.jd-active {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 4px;
}
.jd-active input { accent-color: var(--gold); flex: 0 0 auto; }

/* ---------- the auto-fill line under a duties box ---------- */

.jd-filled {
  font-size: 12px;
  line-height: 1.55;
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex-wrap: wrap;
  min-width: 0;
}
.jd-filled-lbl { color: var(--ink-soft); overflow-wrap: anywhere; }
.jd-note-muted { font-size: 12px; line-height: 1.55; color: var(--ink-faint); overflow-wrap: anywhere; }

.jd-offer {
  border: 1px solid rgba(169, 130, 76, .40);
  background: rgba(169, 130, 76, .09);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  min-width: 0;
}
.jd-offer-txt {
  font-size: 12.5px;
  line-height: 1.55;
  margin-bottom: 9px;
  overflow-wrap: anywhere;
}
.jd-offer-btns { display: flex; gap: 7px; flex-wrap: wrap; }

/* "Cook and Sous Chef share NOC 62200" — the one that was not chosen. */
.jd-alts {
  flex: 1 1 100%;
  font-size: 11.5px;
  color: var(--ink-faint);
  margin-top: 5px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.jd-alt-btn {
  border: 1px solid var(--stroke);
  background: var(--paper);
  color: var(--gold-deep);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.7;
}
.jd-alt-btn:hover { border-color: var(--gold); background: var(--bone); }

/* ---------- the duties box on the LMIA / posting forms ---------- */

.jd-field textarea {
  width: 100%;
  min-height: 110px;
  padding: 9px 11px;
  border: 1px solid var(--stroke);
  border-radius: var(--r-sm);
  background: var(--paper);
  line-height: 1.55;
  font-size: 13.5px;
  /* height is driven by jdAutosize() — the whole list has to be visible,
     because a clipped duty on a contract field reads as no duty at all. */
  resize: none;
  overflow: hidden;
  outline: none;
}
.jd-field textarea:focus { border-color: var(--gold); }
.jd-field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.jd-field-head .panel-title { flex: 1 1 220px; min-width: 0; }
.jd-field-head .btn { flex: 0 0 auto; margin-left: auto; }
.jd-field-note { margin-top: 7px; min-width: 0; }

/* ---------- 390px ---------- */

@media (max-width: 640px) {
  .jd-toolbar { gap: 8px; }
  .jd-search { flex: 1 1 100%; }
  .jd-toolbar-btns { width: 100%; }
  .jd-toolbar-btns .btn { flex: 1 1 auto; }

  /* The chevron column buys nothing on a phone and the title needs the
     width more than it does. */
  .jd-row { padding: 10px 11px; gap: 8px; }
  .jd-row-go i, .jd-row-go svg { display: none; }
  .jd-row-seed { flex-direction: column; align-items: stretch; }
  .jd-row-seed .jd-row-go { justify-content: flex-start; }
  .jd-row-seed .btn { width: 100%; }

  /* Stack the reorder buttons in a row under the text: three 26px buttons
     in a column beside a shrinking textarea is how this overflows. */
  .jd-line { flex-wrap: wrap; }
  .jd-line-n { flex: 0 0 18px; padding-top: 8px; }
  .jd-line-in { flex: 1 1 100%; order: 2; width: auto; }
  .jd-line-btns { flex-direction: row; order: 3; margin-left: 26px; }
  .jd-mini { width: 34px; height: 26px; }

  .jd-lines { max-height: 40vh; padding: 7px; }
  .jd-offer-btns .btn { flex: 1 1 100%; }

  /* "Manage library" belongs beside the heading on a desktop and under it
     on a phone — not floating in the middle of a wrapped flex row.
     flex-basis has to be reset with the direction: `flex:1 1 220px` means
     220px of WIDTH in a row and 220px of HEIGHT in a column, which turned
     the heading into a quarter-screen of empty paper. */
  .jd-field-head { flex-direction: column; align-items: stretch; gap: 8px; }
  .jd-field-head .panel-title { flex: 0 0 auto; }
  .jd-field-head .btn { margin-left: 0; align-self: flex-start; }
}
