/* #697 Common problems (staff only), on the Finances page's base (finances.css), like Support calls: same palette, 44px
   targets, text at least 14px. What's added: the cards' headings, the need-a-person list, the common problems (each opens
   to its reports), and the switch. */

/* Several blocks here set their own display; hidden always wins. */
[hidden] { display: none !important; }

.sp-cards .card h2 { margin: 0; font-size: 14px; font-weight: 650; color: var(--muted); }
.sp-cards .card.attention { border-color: #f0c98a; background: linear-gradient(180deg, var(--warn-bg), #fff 70%); }
.sp-cards .card.attention .big { color: var(--warn); }

.sp-mode { margin: 6px 0 0; padding: 10px 14px; border-radius: 12px; background: var(--warn-bg); color: var(--warn); font-weight: 600; }

.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.good { background: var(--good-bg); color: var(--good); }
.tag.plain { background: #eef1f3; color: #3f525c; }
.tag.live { background: #e6f2f8; color: #075e82; }
.count:empty { display: none; }

.sp-people.attention { border-color: #f0c98a; }
/* Where the other follow-ups are: a whole 44px target. */
.sp-elsewhere { margin: -6px 0 6px; }
.sp-elsewhere a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
.panel h2 { display: flex; align-items: center; gap: 8px; }
.panel > p.muted { margin: 0 0 10px; }

.sp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sp-item, .sp-report { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.sp-item.done { background: #fafbfc; }
.sp-item.focus { border-color: var(--brand); box-shadow: inset 4px 0 0 var(--brand); }
.sp-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; }
.sp-head .who { font-weight: 700; font-size: 15px; overflow-wrap: anywhere; }
.sp-head .when { color: var(--muted); font-size: 14px; }
.sp-summary { margin: 6px 0 8px; overflow-wrap: anywhere; }
.sp-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.sp-meta { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0; color: var(--muted); }
.sp-meta a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }

/* A common problem: the whole summary row is the 44px target that opens it. */
.sp-topic { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.sp-topic[open] { border-color: #a9d3e6; }
.sp-topic > summary { display: grid; gap: 4px; min-height: 44px; padding: 12px 40px 12px 14px; cursor: pointer; list-style: none; position: relative; }
.sp-topic > summary::-webkit-details-marker { display: none; }
.sp-topic > summary::after { content: ""; position: absolute; right: 18px; top: 20px; width: 9px; height: 9px; border: solid var(--muted);
  border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform .15s; }
.sp-topic[open] > summary::after { transform: rotate(-135deg); top: 24px; }
.sp-title { font-weight: 700; font-size: 16px; overflow-wrap: anywhere; }
.sp-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.sp-area { color: var(--muted); font-size: 14px; }
.sp-line { color: var(--muted); font-size: 14px; }
.sp-line.doing { color: var(--ink); }
.sp-line:empty { display: none; }
.sp-item-link { margin: 0; padding: 0 14px 4px; }
.sp-item-link a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
.sp-topic-body { padding: 0 14px 14px; }
.sp-fix { margin: 0 0 10px; }
.sp-reports { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sp-report { background: #fafbfc; }
.sp-report .sp-summary { margin: 4px 0 4px; }
.sp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.error { color: var(--bad); font-weight: 600; }

/* Who a report came from, with the QA badge (a test, not a customer), and where and when its chat started. */
.tag.qa { background: #efe9fb; color: #4f2f91; }
.sp-head .who { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.sp-head .who .tag { font-weight: 650; }
.sp-where { margin: 2px 0 0; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }

/* One problem's conversation: a 44px row opens it; then who it was (facts) and the transcript as bubbles, the person on
   the right and us on the left, never wider than the card. */
.sp-convo { margin: 2px 0 8px; border-top: 1px solid var(--line); min-width: 0; }
.sp-convo > summary { display: flex; align-items: center; min-height: 44px; padding-right: 28px; cursor: pointer; list-style: none;
  position: relative; font-weight: 650; color: var(--brand); }
.sp-convo > summary::-webkit-details-marker { display: none; }
.sp-convo > summary::after { content: ""; position: absolute; right: 8px; top: 15px; width: 8px; height: 8px; border: solid var(--brand);
  border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform .15s; }
.sp-convo[open] > summary::after { transform: rotate(-135deg); top: 19px; }
.sp-convo-body { display: grid; gap: 12px; padding: 2px 0 6px; min-width: 0; }
.sp-facts { margin: 0; padding: 6px 12px; border-radius: 10px; background: #f1f6f8; display: grid; min-width: 0; }
.sp-fact { display: grid; grid-template-columns: 9.5em minmax(0, 1fr); gap: 0 12px; align-items: baseline; padding: 4px 0; }
.sp-fact + .sp-fact { border-top: 1px solid #e2eaee; }
.sp-fact dt { font-size: 14px; font-weight: 650; color: var(--muted); padding-top: 2px; }
/* Each part (a name, a link, a role) wraps whole onto the next line rather than splitting beside a 44px link. */
.sp-fact dd { margin: 0; font-size: 15px; overflow-wrap: anywhere; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; column-gap: 14px; }
.sp-fact dd > span { min-width: 0; padding: 2px 0; }
.sp-fact dd a { display: inline-flex; align-items: center; min-height: 44px; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.sp-fact.qa dt, .sp-fact.qa dd { color: #4f2f91; font-weight: 650; }
.sp-request { padding: 10px 12px; border-left: 3px solid var(--brand); border-radius: 4px 10px 10px 4px; background: var(--panel); }
.sp-request h4 { margin: 0 0 4px; font-size: 14px; color: var(--muted); }
.sp-request p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.sp-removed { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.sp-transcript-title { margin: 2px 0 -4px; font-size: 15px; }
.sp-transcript { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; min-width: 0; }
.sp-turn { display: grid; gap: 2px; max-width: min(88%, 680px); min-width: 0; justify-self: start; }
.sp-turn .meta { font-size: 14px; color: var(--muted); }
.sp-turn .text { margin: 0; padding: 10px 12px; border-radius: 12px; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; white-space: pre-wrap; }
.sp-turn.us .text { background: #eef3f6; border-top-left-radius: 4px; }
.sp-turn.them { justify-self: end; }
.sp-turn.them .meta { text-align: right; }
.sp-turn.them .text { background: #e2f1f8; border: 1px solid #c3e2f0; border-top-right-radius: 4px; }
.sp-more { display: grid; justify-items: center; gap: 2px; padding: 2px 0; }
.sp-more button { min-height: 44px; }

.sp-modes { border: 0; margin: 0 0 8px; padding: 0; display: grid; gap: 4px; }
.sp-modes legend { font-weight: 650; font-size: 14px; margin-bottom: 4px; padding: 0; }
.sp-modes .check { align-items: flex-start; font-weight: 400; }
.sp-modes .check span { padding-top: 11px; }
.sp-limit { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; margin: 6px 0; }
.sp-limit label { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.sp-limit input { width: 88px; }

@media (max-width: 640px) {
  .sp-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .sp-cards .card { padding: 14px; }
  .sp-cards .card .big { font-size: 26px; }
  .sp-foot button, .sp-actions button { flex: 1 1 auto; }
  /* On a phone each fact's label sits above it, and the bubbles take a little more of the width. */
  .sp-fact { grid-template-columns: minmax(0, 1fr); padding: 6px 0; }
  .sp-turn { max-width: 92%; }
  .sp-more button { width: 100%; }
}
