/* ==========================================================================
   Call Outcome modal
   Scoped to .call-outcome so the rest of the console keeps its own scale.
   ========================================================================== */

#call-detail-content:has(.call-outcome) {
  max-width: 860px !important;
  width: 100%;
}

.call-outcome {
  --co-caller: #b45309;
  --co-card-bg: var(--px-surface, #ffffff);
  --co-border: var(--px-line, #e5e7eb);
  --co-ink: var(--px-ink, #14171a);
  --co-ink-2: var(--px-ink-2, #5b636c);
  --co-ink-3: var(--px-ink-3, #7f868e);
  --co-quiet: var(--px-quiet-2, #f3f4f6);
  --co-blue: #2f6fed;
  --co-blue-soft: rgba(47, 111, 237, .10);
  --co-red: #e5484d;
  --co-amber-bg: rgba(217, 119, 6, .13);
  --co-amber-ink: #92500b;
  display: flex;
  flex-direction: column;
  gap: 16px;
  color: var(--co-ink);
  animation: co-fade-in .16s ease-out;
}

@keyframes co-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

[data-theme="light"] .call-outcome {
  --co-card-bg: #ffffff;
  --co-border: #e5e7eb;
}

/* ---------- header ------------------------------------------------------- */
.call-outcome .co-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.call-outcome .co-head-main { min-width: 0; }

.call-outcome .co-title {
  margin: 0;
  font-family: var(--font-display, inherit);
  font-size: 26px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--co-ink);
}

.call-outcome .co-subline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--co-ink-2);
}

.call-outcome .co-name { font-weight: 600; color: var(--co-ink); }
.call-outcome .co-phone { font-variant-numeric: tabular-nums; }
.call-outcome .co-status { text-transform: capitalize; }
.call-outcome .co-sep { color: var(--co-ink-3); }

.call-outcome .co-close {
  flex: 0 0 auto;
  padding: 7px 14px;
  font-family: var(--font-display, inherit);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  color: var(--co-ink-2);
  background: transparent;
  border: 1px solid var(--co-border);
  border-radius: 999px !important;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}

.call-outcome .co-close:hover {
  color: var(--co-ink);
  border-color: var(--co-ink-3);
  background: var(--co-quiet);
}

/* ---------- cards -------------------------------------------------------- */
.call-outcome .co-card {
  min-width: 0;
  padding: 22px;
  background: var(--co-card-bg);
  border: 1px solid var(--co-border);
  border-radius: 12px !important;
}

.call-outcome .co-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.call-outcome .co-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-display, inherit);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--co-ink-2);
}

.call-outcome .co-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: var(--co-ink-3);
}

.call-outcome .co-ico svg {
  display: block;
  width: 16px;
  height: 16px;
}

.call-outcome .co-body-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--co-ink);
}

.call-outcome .co-empty {
  font-size: 13px;
  line-height: 1.5;
  color: var(--co-ink-3);
}

.call-outcome .co-error {
  font-size: 13px;
  line-height: 1.55;
  color: var(--co-ink-2);
}

/* ---------- two-column rows --------------------------------------------- */
.call-outcome .co-row {
  display: grid;
  gap: 16px;
}

.call-outcome .co-row-2 {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
}

.call-outcome .co-row-single {
  grid-template-columns: minmax(0, 1fr);
}

/* ---------- share of voice ---------------------------------------------- */
.call-outcome .co-sov {
  display: flex;
  align-items: center;
  gap: 28px;
}

.call-outcome .co-sov-body {
  flex: 1 1 auto;
  min-width: 0;
}

.call-outcome .co-sov-bar {
  display: flex;
  width: 100%;
  height: 14px;
  overflow: hidden;
  background: var(--co-quiet);
  border-radius: 999px !important;
}

.call-outcome .co-sov-seg {
  display: block;
  height: 100%;
  min-width: 0;
}

.call-outcome .co-sov-seg.is-assistant { background: var(--co-blue); }
.call-outcome .co-sov-seg.is-prospect { background: var(--co-red); }

.call-outcome .co-sov-pcts {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 9px;
}

.call-outcome .co-sov-pct {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--co-ink);
  font-variant-numeric: tabular-nums;
}

.call-outcome .co-sov-pct small {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--co-ink-3);
}

.call-outcome .co-sov-pct.is-right {
  align-items: flex-end;
  text-align: right;
}

.call-outcome .co-legend {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 9px;
  font-size: 12px;
  line-height: 1.2;
  color: var(--co-ink-2);
}

.call-outcome .co-legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.call-outcome .co-key {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 3px !important;
}

.call-outcome .co-key.is-assistant { background: var(--co-blue); }
.call-outcome .co-key.is-prospect { background: var(--co-red); }

/* ---------- recording ---------------------------------------------------- */
.call-outcome .co-audio {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  height: 44px;
  background: var(--co-quiet);
  border-radius: 999px !important;
}

.call-outcome .co-audio::-webkit-media-controls-enclosure {
  border-radius: 999px !important;
}

.call-outcome .co-download {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  padding: 4px 2px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--co-ink-2);
  text-decoration: none;
  white-space: nowrap;
}

.call-outcome .co-download:hover { color: var(--co-ink); }
.call-outcome .co-download .co-ico { width: 14px; height: 14px; }
.call-outcome .co-download .co-ico svg { width: 14px; height: 14px; }

/* ---------- chips -------------------------------------------------------- */
.call-outcome .co-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 5px 11px;
  font-family: var(--font-display, inherit);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: .04em;
  text-transform: uppercase;
  border: 1px solid transparent;
  border-radius: 999px !important;
}

.call-outcome .co-chip-action {
  background: var(--co-amber-bg);
  color: var(--co-amber-ink);
}

.call-outcome .co-emotion-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.call-outcome .co-chip-emotion.is-neutral {
  background: var(--co-quiet);
  color: var(--co-ink);
}

.call-outcome .co-chip-emotion.is-positive {
  background: rgba(22, 163, 74, .13);
  color: #146c43;
}

.call-outcome .co-chip-emotion.is-negative {
  background: rgba(229, 72, 77, .13);
  color: #a3242a;
}

.call-outcome .co-confidence {
  font-size: 11px;
  line-height: 1.2;
  color: var(--co-ink-3);
}

.call-outcome .co-rationale {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--co-ink-2);
}

/* ---------- QA ----------------------------------------------------------- */
.call-outcome .co-qa-number {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 44px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.03em;
  color: var(--co-ink);
  font-variant-numeric: tabular-nums;
}

.call-outcome .co-qa-caption {
  margin-top: 9px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--co-ink-3);
}

/* ---------- recommended actions ----------------------------------------- */
.call-outcome .co-bullets {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.call-outcome .co-bullets li {
  position: relative;
  padding-left: 18px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--co-ink);
}

.call-outcome .co-bullets li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .62em;
  width: 6px;
  height: 6px;
  background: var(--co-ink-3);
  border-radius: 50% !important;
}

.call-outcome .co-bullets li.is-dispo {
  font-weight: 650;
}

.call-outcome .co-bullets li.is-dispo::before {
  background: var(--co-blue);
}

/* ---------- transcript --------------------------------------------------- */
.call-outcome .co-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 6px 11px;
  font-family: var(--font-display, inherit);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--co-ink-2);
  background: transparent;
  border: 1px solid var(--co-border);
  border-radius: 999px !important;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}

.call-outcome .co-btn:hover:not(:disabled) {
  color: var(--co-ink);
  border-color: var(--co-ink-3);
  background: var(--co-quiet);
}

.call-outcome .co-btn:disabled { cursor: default; opacity: .65; }
.call-outcome .co-btn .co-ico { width: 14px; height: 14px; }
.call-outcome .co-btn .co-ico svg { width: 14px; height: 14px; }

.call-outcome .co-transcript-body {
  margin-top: 2px;
}

.call-outcome .co-transcript-body .transcript-box,
.call-outcome .co-transcript-plain {
  max-height: 380px;
  overflow-y: auto;
  padding: 14px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--co-ink-2);
  background: var(--co-quiet);
  border: 1px solid var(--co-border);
  border-radius: 10px !important;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.call-outcome .co-turns {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 380px;
  overflow-y: auto;
  padding: 14px;
  background: var(--co-quiet);
  border: 1px solid var(--co-border);
  border-radius: 10px !important;
}

.call-outcome .co-turn {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--co-ink);
  /* Side rail so each side is recognisable at a glance. */
  border-left: 3px solid transparent;
  padding-left: 11px;
}

.call-outcome .co-turn-speaker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--co-ink-3);
}

.call-outcome .co-turn.is-assistant { border-left-color: var(--co-blue); }
.call-outcome .co-turn.is-prospect { border-left-color: var(--co-caller); }
.call-outcome .co-turn-speaker.is-assistant { color: var(--co-blue); }
.call-outcome .co-turn-speaker.is-prospect { color: var(--co-caller); }
.call-outcome .co-turn-text { overflow-wrap: anywhere; }

/* ---------- dark-theme text corrections --------------------------------- */
[data-theme="dark"] .call-outcome .co-chip-action {
  background: rgba(245, 158, 11, .14);
  color: #f3c477;
}

[data-theme="dark"] .call-outcome .co-chip-emotion.is-positive {
  background: rgba(34, 197, 94, .14);
  color: #7ee2a1;
}

[data-theme="dark"] .call-outcome .co-chip-emotion.is-negative {
  background: rgba(229, 72, 77, .16);
  color: #ff9a9d;
}

/* ---------- mobile ------------------------------------------------------- */
@media (max-width: 700px) {
  .call-outcome .co-card { padding: 18px; }
  .call-outcome .co-title { font-size: 22px; }
  .call-outcome .co-row-2 { grid-template-columns: minmax(0, 1fr); }
  .call-outcome .co-sov {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }
  .call-outcome .co-legend {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px 18px;
  }
  .call-outcome .co-qa-number { font-size: 38px; }
}

@media (max-width: 420px) {
  .call-outcome { gap: 12px; }
  .call-outcome .co-card { padding: 16px; }
  .call-outcome .co-head { gap: 10px; }
  .call-outcome .co-title { font-size: 20px; }
  .call-outcome .co-subline { font-size: 12px; }
  .call-outcome .co-card-head { flex-wrap: wrap; }
  .call-outcome .co-transcript-body .transcript-box,
  .call-outcome .co-transcript-plain,
  .call-outcome .co-turns { max-height: 300px; }
}

[data-theme="dark"] .call-outcome { --co-caller: #fbbf24; }
