/* Decision / category badges, fallback pill, "Why?" panel and the legend
   (W3-A, P3.2209). Strict CSP: classes only, no inline styles. */

.badge-decision { display: inline-block; max-width: 12rem; font-size: 0.7rem; font-weight: 700; line-height: 1.25; padding: 3px 8px; border-radius: 4px; white-space: normal; overflow-wrap: break-word; cursor: help; }
.dec-auto-approvable { background: #d5f5e3; color: #1e8449; }
.dec-needs-physician, .dec-needs-review { background: #fadbd8; color: #c0392b; }
.dec-deny { background: #f5b7b1; color: #922b21; }
.dec-auto-handle { background: #d5f5e3; color: #1e8449; }
.dec-draft-review { background: #d6eaf8; color: #1a5276; }
.dec-routed-to-refill { background: #fdebd0; color: #ca6f1e; }
.dec-llm-fallback, .dec-unknown { background: #fef5e7; color: #b9770e; }
/* P3.2222: no rule sorted the item; distinct from the red "Needs the doctor". */
.dec-not-sorted { background: #ebedef; color: #34495e; border: 1px dashed #7f8c8d; }

.badge-cat { font-size: 0.7rem; padding: 2px 7px; border-radius: 4px; font-weight: 700; cursor: help; }
.cat-lab { background: #d6eaf8; color: #1a5276; }
.cat-msg { background: #d5f5e3; color: #1e8449; }
.cat-doc { background: #fef9e7; color: #b7950b; }
.cat-other { background: #f0f0f0; color: #555; }
/* P3.2307: an inbox refill request (category refill_request). */
.cat-refill { background: #fdebd0; color: #935116; }

.pill-fallback { display: inline-block; background: #fef5e7; color: #b9770e; padding: 1px 6px; border-radius: 3px; font-size: 0.65rem; font-weight: 700; margin-left: 6px; cursor: help; }

/* "Why?" toggle on each card: closed by default on every screen size. */
.why { font-size: 0.75rem; color: #666; margin-top: 4px; }
.why-toggle { cursor: pointer; color: #1a5276; font-weight: 600; }
.why-body { margin-top: 4px; padding: 6px 8px; background: #f8f9fa; border-radius: 4px; overflow-wrap: anywhere; }
.why-body > div + div { margin-top: 2px; }
.why-label { color: #888; }

/* Legend (#legend): collapsed <details> above the tabs' content. */
.legend { margin: 0 0 14px; }
.legend-box { background: white; border-radius: 8px; padding: 8px 14px; box-shadow: 0 1px 3px rgba(0,0,0,.1); font-size: 0.82rem; }
.legend-toggle { cursor: pointer; font-weight: 600; color: #1a5276; }
.legend-list { list-style: none; margin: 8px 0 2px; padding: 0; }
.legend-row { display: flex; gap: 10px; align-items: flex-start; padding: 4px 0; }
.legend-badge { flex: 0 0 13rem; max-width: 13rem; }
.legend-badge .pill-fallback, .legend-badge .urgent-label { margin: 0; }
.legend-text { flex: 1; min-width: 0; color: #444; overflow-wrap: anywhere; }
/* Round 2 (P3.2209): group captions and count-tile names in the legend. */
.legend-group { margin: 10px 0 2px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; color: #7f8c8d; }
.legend-group:first-child { margin-top: 0; }
.legend-tile { display: inline-block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; color: #555; background: #f4f6f7; border: 1px solid #d5d8dc; border-radius: 4px; padding: 2px 6px; }
.stat-card[title] { cursor: default; }

@media (max-width: 640px) {
  .pill-fallback { margin-left: 0; }
  .badge-decision { max-width: 100%; }
  .legend-row { flex-direction: column; gap: 2px; }
  .legend-badge { flex: none; max-width: 100%; }
}
.legend-term { display: inline-block; font-weight: 700; color: #2c3e50; overflow-wrap: anywhere; }
.legend-done-chip { display: inline-block; font-size: 0.75rem; font-weight: 700; color: #444; background: #f4f6f7; border: 1px solid #d5d8dc; border-radius: 10px; padding: 1px 7px; cursor: help; }

/* P3.4865: the visible line under each tab's count tiles. */
.tile-subtitle { margin: -20px 0 16px; font-size: 0.85rem; color: #555; }
@media (max-width: 600px) { .tile-subtitle { margin-top: -10px; } }
