/* Problems the crew flagged — the office side (Work Orders 1.29).
   js/service-ticket-flags.js paints these: the ticket list badges, the
   "Problems from the crew" panel on an open ticket, the "Needs office" chip on
   a building card, and the count on the job's Service Tickets section. Tokens
   and fallbacks match css/styles.css. */

/* ── list badges ─────────────────────────────────────────────────────────── */
.p86-st-badge {
  display: inline-block; flex: 0 0 auto;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.2px; line-height: 1.4;
  padding: 2px 8px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--border, #333); color: var(--text-dim, #aaa);
}
.p86-st-badge.is-flag { color: var(--red, #dc2626); border-color: var(--red, #dc2626); background: rgba(220, 38, 38, 0.10); }
.p86-st-badge.is-sugg { color: var(--accent, #4f8cff); border-color: var(--accent, #4f8cff); background: rgba(79, 140, 255, 0.10); }
.p86-st-badge.is-new  { color: var(--green, #059669); border-color: var(--green, #059669); background: rgba(5, 150, 105, 0.10); }

/* ── "Needs office" on a building card ───────────────────────────────────── */
.p86-wo-flagchip {
  display: inline-block; flex: 0 0 auto;
  font-size: 10px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase;
  padding: 1px 7px; border-radius: 999px; white-space: nowrap;
  color: var(--red, #dc2626); border: 1px solid var(--red, #dc2626); background: rgba(220, 38, 38, 0.10);
}

/* ── the panel ───────────────────────────────────────────────────────────── */
.p86-st-flags { margin: 4px 0 10px; }
.p86-st-flags-badge {
  font-size: 10px; letter-spacing: 0.4px; text-transform: none; font-weight: 700;
  background: var(--red, #dc2626); color: #fff;
  border-radius: 999px; padding: 1px 7px; margin-left: 6px;
}
.p86-st-flag {
  border: 1px solid var(--border, #333); border-left: 3px solid var(--yellow, #d97706);
  border-radius: 8px; padding: 9px 11px; margin-bottom: 8px;
  background: var(--surface2, rgba(255, 255, 255, 0.03));
}
.p86-st-flag.cat-safety { border-left-color: var(--red, #dc2626); }
.p86-st-flag.is-resolved { border-left-color: var(--border, #333); opacity: 0.85; }
.p86-st-flag-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px;
  font-size: 12px; color: var(--text, #fff);
}
.p86-st-flag-cat {
  font-size: 10px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase;
  padding: 1px 7px; border-radius: 999px; flex: 0 0 auto;
  color: var(--yellow, #d97706); border: 1px solid var(--yellow, #d97706);
}
.p86-st-flag.cat-safety .p86-st-flag-cat { color: var(--red, #dc2626); border-color: var(--red, #dc2626); }
.p86-st-flag.is-resolved .p86-st-flag-cat { color: var(--text-dim, #888); border-color: var(--border, #333); }
.p86-st-flag-where { font-weight: 600; }
.p86-st-flag-who { display: inline-flex; align-items: center; gap: 5px; color: var(--text-dim, #aaa); }
.p86-st-flag-when { color: var(--text-dim, #888); margin-left: auto; font-variant-numeric: tabular-nums; }
.p86-st-flag-note {
  font-size: 12.5px; color: var(--text, #fff); margin: 7px 0 2px;
  white-space: pre-wrap; line-height: 1.45; overflow-wrap: anywhere;
}
.p86-st-flag-photos { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; }
/* A <button>: the global button rule's centring, padding and hover wash are set
   back here so a thumb stays a thumb. */
.p86-st-flag-thumb {
  width: 64px; height: 64px; padding: 0; margin: 0; overflow: hidden;
  border: 1px solid var(--border, #333); border-radius: 6px;
  background: var(--input-bg, #101014); cursor: zoom-in;
}
.p86-st-flag-thumb:hover { background: var(--input-bg, #101014); border-color: var(--accent, #4f8cff); }
.p86-st-flag-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.p86-st-flag-resolve { display: flex; gap: 6px; align-items: center; margin: 9px 0 0; }
.p86-st-flag-note-in {
  flex: 1 1 auto; min-width: 0;
  background: var(--input-bg, #101014); color: var(--text, #fff);
  border: 1px solid var(--border, #333); border-radius: 6px;
  padding: 6px 9px; font-size: 13px; font-family: inherit;
}
.p86-st-flag-res { font-size: 12px; color: var(--text-dim, #aaa); margin: 7px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.p86-st-flag-acts { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.p86-st-flag-acts:empty { display: none; }
.p86-st-flags-more {
  display: inline-block; margin: 0 0 8px; padding: 3px 0;
  background: none; border: 0; color: var(--accent, #4f8cff);
  font-size: 12px; font-weight: 600; cursor: pointer;
}
.p86-st-flags-more:hover { background: none; text-decoration: underline; }

/* ── the job's Service Tickets chip ──────────────────────────────────────────
   Section chips are hidden on the horizontal (phone) strip. This one says the
   crew needs the office, so it stays visible there whenever it has a count. */
.ws-right-tab-chip[data-jobchip="job-service-tickets"][data-tone]:not(:empty) {
  display: inline-block;
  margin-left: 6px;
  font-size: 10px; font-weight: 700; line-height: 1.4;
  padding: 1px 6px; border-radius: 9px; white-space: nowrap;
}
.ws-right-tab-chip[data-jobchip="job-service-tickets"][data-tone="r"]:not(:empty) { color: #f77066; background: rgba(247, 112, 102, .14); }
.ws-right-tab-chip[data-jobchip="job-service-tickets"][data-tone="o"]:not(:empty) { color: #f2a55c; background: rgba(242, 165, 92, .14); }

/* ── phones: the ticket row wraps instead of clipping its badges ─────────── */
@media (max-width: 760px) {
  #job-service-tickets .p86-st-row-head { flex-wrap: wrap; row-gap: 6px; }
  #job-service-tickets .p86-st-row-head .p86-st-title { flex: 1 1 60%; min-width: 0; }
  .p86-st-flag-when { margin-left: 0; }
  .p86-st-flag-resolve { flex-wrap: wrap; }
  .p86-st-flag-note-in { flex-basis: 100%; font-size: 16px; min-height: 40px; }
  .p86-st-flag-thumb { width: 72px; height: 72px; }
}
