:root {
  color-scheme: light;
  --paper: #f5f6f2;
  --surface: #ffffff;
  --ink: #16211c;
  --muted: #65726b;
  --line: #dfe4de;
  --line-strong: #cbd3cc;
  --green: #18794e;
  --green-soft: #e7f4ec;
  --teal: #0f6b67;
  --amber: #9a5b13;
  --amber-soft: #fff4df;
  --red: #b23b3b;
  --blue: #3767a4;
  --sidebar: 470px;
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  letter-spacing: 0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
}

button, input { font: inherit; letter-spacing: 0; }
button { color: inherit; }

.app-header {
  height: 58px;
  display: grid;
  grid-template-columns: 190px 1fr auto;
  align-items: center;
  padding: 0 24px;
  background: #14241d;
  color: #f7faf7;
  border-bottom: 1px solid #20372d;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  font-size: 18px;
  font-weight: 700;
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: #f4c95d;
  color: #14241d;
  border-radius: 6px;
  font-size: 15px;
}

.header-context {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #c4d0ca;
}

.demo-badge {
  padding: 3px 7px;
  border: 1px solid #436052;
  border-radius: 4px;
  color: #9eb3a8;
  font-size: 9px;
  font-weight: 700;
}

.header-actions { display: flex; align-items: center; gap: 12px; }
.icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: #c4d0ca;
  cursor: pointer;
}
.icon-button svg { width: 18px; }

.avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #d6e8dd;
  color: #163d2d;
  font-size: 11px;
  font-weight: 700;
}

main { max-width: 1600px; margin: 0 auto; }

.case-header {
  min-height: 108px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 30px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.case-heading { display: flex; align-items: flex-start; gap: 14px; min-width: 0; }
.back-link {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
}
.back-link svg { width: 16px; }

.eyebrow {
  display: block;
  color: #748078;
  font-size: 10px;
  font-weight: 700;
}

h1, h2, h3, p { margin: 0; }
h1 { margin-top: 4px; font-size: 25px; line-height: 1.2; }
.case-heading p { margin-top: 4px; color: var(--muted); font-size: 13px; }

.case-status {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  color: var(--green);
  font-size: 13px;
  font-weight: 600;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #32a66a; }
.status-time { margin-left: 10px; color: var(--muted); font-weight: 400; }

.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr)) minmax(250px, 1.4fr);
  background: #eef1ec;
  border-bottom: 1px solid var(--line-strong);
}
.metric { min-height: 76px; padding: 15px 30px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric-label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 9px; font-weight: 700; }
.metric strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.metric small { color: var(--muted); font-size: 12px; font-weight: 500; }
.metric .review-count { color: var(--amber); }
.metric-reference strong { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--sidebar);
  min-height: calc(100vh - 242px);
  background: var(--surface);
}

.call-column { min-width: 0; padding: 24px 30px 0; border-right: 1px solid var(--line-strong); }
.section-heading, .results-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.section-heading h2, .results-header h2 { margin-top: 3px; font-size: 16px; }

.recording-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid #f0d4d4;
  border-radius: 5px;
  color: var(--red);
  font-size: 10px;
  font-weight: 700;
}
.recording-pill span { width: 6px; height: 6px; border-radius: 50%; background: var(--red); }
.recording-pill.public-sample { border-color: #d8c58f; color: #8a6618; }
.recording-pill.public-sample span { background: #c4932d; }

.redacted-note {
  margin: 0 0 10px 51px;
  color: #7b857e;
  font-size: 9px;
}

.player { margin-top: 16px; padding: 15px 16px 12px; background: #f1f4ef; border: 1px solid var(--line); border-radius: 6px; }
.player-controls { display: flex; align-items: center; gap: 13px; }
.play-button {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  cursor: pointer;
}
.play-button svg {
  width: 16px;
  height: 16px;
  display: block;
  grid-area: 1 / 1;
  fill: currentColor;
}
.play-button .pause-icon { display: none; }
.play-button.is-playing .play-icon { display: none; }
.play-button.is-playing .pause-icon { display: block; }
.player-main { min-width: 0; flex: 1; }
.time-row { display: flex; justify-content: space-between; margin-bottom: 5px; color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.speed-button { width: 32px; padding: 4px 0; border: 0; background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; cursor: pointer; }

.progress { width: 100%; height: 4px; display: block; margin: 0; accent-color: var(--green); cursor: pointer; }
.phase-track { display: grid; grid-template-columns: repeat(4, auto); justify-content: start; gap: 18px; margin: 12px 0 0 51px; }
.phase-track button { display: flex; align-items: center; gap: 5px; padding: 0; border: 0; background: none; color: var(--muted); font-size: 9px; cursor: pointer; }
.phase-track button:disabled { opacity: 0.42; cursor: default; }
.phase-track small { color: #909b94; }
.phase { width: 6px; height: 6px; border-radius: 2px; }
.phase.ivr { background: var(--blue); }
.phase.hold { background: #c39a3f; }
.phase.rep { background: var(--teal); }
.phase.benefits { background: var(--green); }

.transcript-toolbar { display: flex; align-items: center; justify-content: space-between; height: 57px; border-bottom: 1px solid var(--line); }
.transcript-toolbar h3 { font-size: 13px; }
.follow-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 5px; background: white; color: var(--muted); font-size: 10px; cursor: pointer; }
.follow-toggle svg { width: 13px; }
.follow-toggle.active { border-color: #acd2bd; background: var(--green-soft); color: var(--green); }

.transcript { height: 425px; overflow-y: auto; scrollbar-color: #cbd3cc transparent; }
.transcript-loading { padding: 32px 0; color: var(--muted); font-size: 12px; }
.transcript-row { display: grid; grid-template-columns: 58px 78px 1fr; gap: 12px; padding: 10px 12px; border-bottom: 1px solid #edf0ec; cursor: pointer; transition: background 120ms ease; }
.transcript-row:hover { background: #f7f8f5; }
.transcript-row.active { background: #e9f5ed; box-shadow: inset 3px 0 var(--green); }
.transcript-time { color: #929d96; font-size: 10px; font-variant-numeric: tabular-nums; }
.speaker { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 10px; font-weight: 700; }
.speaker::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--teal); }
.speaker.agent::before { background: var(--blue); }
.speaker.ivr::before { background: #c39a3f; }
.transcript-text { color: #354139; font-size: 12px; line-height: 1.45; }

.results-column { min-width: 0; background: #fbfcfa; }
.results-header { min-height: 80px; padding: 18px 22px; }
.confidence-ring { width: 44px; height: 44px; display: grid; place-items: center; position: relative; border: 4px solid #b9dec8; border-left-color: var(--green); border-radius: 50%; color: var(--green); transform: rotate(8deg); }
.confidence-ring strong, .confidence-ring span { transform: rotate(-8deg); }
.confidence-ring strong { margin-left: -4px; font-size: 12px; }
.confidence-ring span { position: absolute; margin-left: 18px; font-size: 8px; }

.tabs { display: grid; grid-template-columns: repeat(3, 1fr); padding: 0 22px; border-bottom: 1px solid var(--line); }
.tab { height: 39px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-size: 11px; cursor: pointer; }
.tab.active { border-bottom-color: var(--green); color: var(--ink); font-weight: 700; }
.tab-panel { display: none; padding-bottom: 20px; }
.tab-panel.active { display: block; }

.result-group { padding: 20px 22px; border-bottom: 1px solid var(--line); }
.result-group h3 { font-size: 12px; }
.group-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.verified-label { display: inline-flex; align-items: center; gap: 4px; color: var(--green); font-size: 9px; font-weight: 700; }
.verified-label svg { width: 13px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.field { min-height: 87px; position: relative; display: flex; flex-direction: column; align-items: flex-start; padding: 11px 30px 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); text-align: left; cursor: pointer; }
.field:hover { border-color: #97c4aa; }
.field span { color: var(--muted); font-size: 9px; }
.field strong { margin-top: 3px; font-size: 17px; }
.field small { margin-top: 3px; color: var(--green); font-size: 9px; }
.field svg { width: 14px; position: absolute; top: 12px; right: 10px; color: #7ca38d; }

.care-list { margin-top: 11px; }
.care-list > div { display: grid; grid-template-columns: 1.2fr auto; gap: 3px 10px; padding: 9px 0; border-bottom: 1px solid #e8ece7; font-size: 10px; }
.care-list > div:last-child { border-bottom: 0; }
.care-list span { color: var(--muted); }
.care-list strong { color: var(--green); font-size: 10px; }
.care-list small { grid-column: 1 / -1; color: #77827b; }

.review-banner { display: grid; grid-template-columns: 24px 1fr 28px; align-items: center; gap: 8px; margin: 16px 22px 0; padding: 11px; border: 1px solid #edcd9b; border-radius: 6px; background: var(--amber-soft); color: var(--amber); }
.review-banner > svg { width: 17px; }
.review-banner strong, .review-banner span { display: block; }
.review-banner strong { font-size: 10px; }
.review-banner span { margin-top: 2px; color: #856e50; font-size: 9px; }
.review-banner button { width: 28px; height: 28px; display: grid; place-items: center; border: 0; background: transparent; color: var(--amber); cursor: pointer; }
.review-banner button svg { width: 15px; }

.detail-list { margin-top: 12px; }
.detail-list button { width: 100%; display: grid; grid-template-columns: 1fr auto 18px; align-items: center; gap: 10px; padding: 13px 0; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; cursor: pointer; }
.detail-list span { color: var(--muted); font-size: 10px; }
.detail-list strong { font-size: 10px; }
.detail-list svg { width: 14px; color: var(--green); }
.detail-list .flagged strong, .detail-list .flagged svg { color: var(--amber); }

.call-details { margin: 12px 0 0; }
.call-details div { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.call-details dt { color: var(--muted); }
.call-details dd { margin: 0; text-align: right; font-weight: 600; }

@media (max-width: 1050px) {
  :root { --sidebar: 410px; }
  .metric { padding-left: 20px; padding-right: 20px; }
  .call-column { padding-left: 20px; padding-right: 20px; }
  .phase-track { gap: 10px; }
  .phase-track small { display: none; }
}

@media (max-width: 820px) {
  .app-header { grid-template-columns: auto 1fr auto; padding: 0 16px; }
  .header-context { justify-content: center; }
  .context-title { display: none; }
  .case-header { align-items: flex-start; padding: 18px 16px; }
  .case-status { flex-wrap: wrap; justify-content: flex-end; }
  .status-time { width: 100%; margin: 0; text-align: right; }
  .metric-strip { grid-template-columns: repeat(2, 1fr); }
  .metric { min-height: 68px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .workspace { grid-template-columns: 1fr; }
  .call-column { padding: 20px 16px 0; border-right: 0; }
  .results-column { border-top: 8px solid var(--paper); }
  .transcript { height: 390px; }
}

@media (max-width: 520px) {
  .header-actions .icon-button { display: none; }
  .case-header { display: block; }
  .case-heading { gap: 8px; }
  .back-link { flex: 0 0 30px; }
  h1 { font-size: 21px; }
  .case-status { justify-content: flex-start; margin: 15px 0 0 38px; }
  .status-time { width: auto; margin-left: 6px; text-align: left; }
  .metric strong { font-size: 17px; }
  .metric-reference strong { overflow-wrap: anywhere; font-size: 11px; }
  .player { padding-left: 11px; padding-right: 11px; }
  .phase-track { grid-template-columns: repeat(2, auto); margin-left: 0; row-gap: 8px; }
  .transcript-row { grid-template-columns: 46px 66px 1fr; gap: 7px; padding-left: 5px; padding-right: 5px; }
  .results-header, .result-group { padding-left: 16px; padding-right: 16px; }
  .tabs { padding: 0 16px; }
  .review-banner { margin-left: 16px; margin-right: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .transcript { scroll-behavior: auto; }
}
