/* MindeLine Voice continuity views. Uses the shared design tokens (mindeline-design.css). */

.cl-inbox h2, .cl-patient h3 { margin: 2px 0 4px; }
.cl-inbox > .panel-head p { max-width: 62ch; }

.cl-filter { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 16px; }
.cl-filter button { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); color: var(--navy-600); font: 500 14px/20px var(--font-body); cursor: pointer; transition: background-color .16s ease, border-color .16s ease, color .16s ease; }
.cl-filter button strong { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--navy-50); color: var(--navy); font-size: 12px; text-align: center; }
.cl-filter button[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: var(--white); }
.cl-filter button[aria-pressed="true"] strong { background: rgba(255, 255, 255, .16); color: var(--white); }
.cl-filter .cl-filter-action_required strong { background: var(--review-bg); color: var(--review-fg); }
.cl-filter button:focus-visible { outline: 3px solid var(--teal-500); outline-offset: 2px; }

.cl-list { display: grid; gap: 10px; }
.cl-list[aria-busy="true"] { opacity: .6; }
.cl-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 14px 16px; border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: var(--radius-card); background: var(--white); }
.cl-card-action_required { border-left-color: var(--review); }
.cl-card-review_required { border-left-color: var(--teal-500); }
.cl-card-completed { border-left-color: var(--stable); }
.cl-card-safety { border-left-color: var(--risk); background: linear-gradient(90deg, var(--risk-bg), var(--white) 28%); }
.cl-card h3 { margin: 0; font-size: 16px; line-height: 22px; }
.cl-card-title { padding: 0; border: 0; background: none; color: var(--navy); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.cl-card-title:hover { text-decoration: underline; }
.cl-headline { margin: 2px 0 0; color: var(--navy); font-weight: 500; }
.cl-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 18px; }
.cl-card-side { display: grid; justify-items: end; gap: 6px; text-align: right; }
.cl-card-side small { color: var(--muted); }
.cl-demo-tag { padding: 1px 8px; border-radius: 999px; background: var(--navy-50); color: var(--navy-600); font-size: 12px; }
.cl-empty { padding: 28px 20px; border: 1px dashed var(--line); border-radius: var(--radius-card); text-align: center; color: var(--muted); }
.cl-empty strong { display: block; color: var(--navy); margin-bottom: 4px; }
.cl-offline, .cl-notice { margin: 0 0 12px; padding: 10px 12px; border-radius: var(--radius-card); background: var(--navy-50); color: var(--navy); }

/* Provenance badges: who said or decided this. */
.cl-source { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; font-size: 12px; line-height: 18px; font-weight: 500; border: 1px solid transparent; }
.cl-source-patient_reported { background: var(--teal-50); color: var(--teal-dark); }
.cl-source-ai_inferred { background: var(--white); border-color: var(--navy-200); color: var(--navy-600); }
.cl-source-clinician_confirmed { background: var(--stable-bg); color: var(--stable-fg); }
.cl-source-unknown, .cl-source-protocol { background: var(--navy-50); color: var(--navy-600); }

/* Channel of origin: a follow-up call, WhatsApp or the portal chat. */
.cl-channel { display: inline-flex; align-items: center; padding: 0 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); color: var(--navy-600); font-size: 12px; line-height: 18px; font-weight: 500; }
.cl-meta.cl-channels { gap: 6px; }
.cl-finding blockquote + blockquote { margin-top: 6px; }
.cl-requests { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.cl-requests li { display: grid; gap: 2px; padding: 10px 12px; border-radius: var(--radius-card); background: var(--bg); color: var(--navy); }
.cl-requests p { margin: 0; font-style: italic; }
.cl-requests small { color: var(--muted); font-size: 12px; }
.cl-attention p { margin: 4px 0 0; }

/* Patient card */
.cl-patient { border-top: 3px solid var(--teal-500); }
.cl-patient .panel-head { align-items: center; }
.cl-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px 20px; margin: 4px 0 14px; }
.cl-facts div { min-width: 0; }
.cl-facts dt { color: var(--muted); font-size: 12px; line-height: 16px; letter-spacing: .02em; text-transform: uppercase; }
.cl-facts dd { margin: 2px 0 0; color: var(--navy); font-weight: 500; overflow-wrap: anywhere; }
.cl-attention { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin: 0 0 12px; padding: 12px 14px; border-radius: var(--radius-card); background: var(--review-bg); color: var(--review-fg); }
.cl-attention strong { color: var(--review-fg); }
.cl-attention ul { margin: 4px 0 0; padding-left: 18px; }
.cl-active { margin: 0 0 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--bg); }
.cl-last { margin: 0 0 10px; color: var(--navy-600); }
.cl-patient-actions { flex-wrap: wrap; margin-top: 4px; }
.cl-demo-note { margin: 12px 0 0; padding: 8px 12px; border-radius: var(--radius-card); background: var(--navy-50); color: var(--navy-600); font-size: 13px; line-height: 18px; }
.cl-ok-note { margin: 0; color: var(--stable-fg); font-weight: 500; }

/* Progress steps */
.cl-steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 0 0 16px; padding: 0; list-style: none; counter-reset: step; }
.cl-steps.compact { margin-bottom: 10px; }
.cl-steps li { position: relative; padding: 10px 10px 10px 12px; border-radius: var(--radius-card); background: var(--white); border: 1px solid var(--line); counter-increment: step; min-width: 0; }
.cl-steps li span { display: block; color: var(--navy); font-size: 13px; line-height: 18px; font-weight: 500; overflow-wrap: anywhere; }
.cl-steps li small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; line-height: 16px; overflow-wrap: anywhere; }
.cl-steps li::before { content: counter(step); display: inline-grid; place-items: center; width: 20px; height: 20px; margin-bottom: 4px; border-radius: 50%; background: var(--navy-50); color: var(--navy-600); font-size: 11px; font-weight: 600; }
.cl-steps li.done::before { content: "✓"; background: var(--stable-bg); color: var(--stable-fg); }
.cl-steps li.current { border-color: var(--teal-500); box-shadow: inset 0 0 0 1px var(--teal-500); }
.cl-steps li.current::before { background: var(--teal-500); color: var(--white); }
.cl-steps li.error { border-color: var(--risk); }
.cl-steps li.error::before { content: "!"; background: var(--risk-bg); color: var(--risk-fg); }
.cl-steps li.todo span { color: var(--muted); }

/* Review sheet */
.cl-dialog { width: min(760px, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0 0 0 auto; padding: 0; border: 0; border-left: 1px solid var(--line); background: var(--bg); color: var(--ink); box-shadow: var(--shadow-lg); }
.cl-dialog.cl-start, .cl-dialog.cl-state { width: min(620px, 100vw); }
.cl-dialog::backdrop { background: rgba(18, 26, 43, .42); }
.cl-dialog[open] { animation: cl-sheet-in .2s ease-out; }
@keyframes cl-sheet-in { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.cl-sheet-body { display: grid; gap: 14px; padding: 22px 24px 32px; }
.cl-sheet-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; position: sticky; top: 0; z-index: 1; margin: -22px -24px 0; padding: 18px 24px 14px; background: var(--white); border-bottom: 1px solid var(--line); }
.cl-sheet-head h2 { margin: 2px 0; font-size: 22px; line-height: 28px; }
.cl-sheet-head h2:focus { outline: none; }
.cl-sheet-head p { margin: 0; color: var(--muted); }
.cl-block { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--white); }
.cl-block h3 { margin: 0 0 8px; font-size: 16px; line-height: 22px; }
.cl-block-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.cl-block-head h3 { margin: 0; }
.cl-summary { margin: 0 0 10px; color: var(--navy); font-size: 15px; line-height: 23px; }
.cl-codes { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; }
.cl-code { padding: 2px 9px; border-radius: 999px; background: var(--navy-50); color: var(--navy-600); font-size: 12px; line-height: 18px; }
.cl-code.primary { background: var(--navy); color: var(--white); }
.cl-code-source { color: var(--muted); font-size: 12px; }
.cl-pending { margin: 10px 0 0; color: var(--navy-600); }
.cl-safety { padding: 14px 16px; border-radius: var(--radius-panel); background: var(--risk-bg); color: var(--risk-fg); border: 1px solid var(--risk); }
.cl-safety p { margin: 4px 0 0; }
.cl-finding { padding: 14px 0; border-top: 1px solid var(--line); }
.cl-finding:first-of-type { border-top: 0; padding-top: 4px; }
.cl-finding-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.cl-finding h4 { margin: 0; font-size: 15px; line-height: 21px; color: var(--navy); }
.cl-finding > p { margin: 6px 0 0; }
.cl-finding blockquote, .cl-report blockquote { margin: 8px 0 0; padding: 6px 12px; border-left: 3px solid var(--teal-500); background: var(--teal-50); color: var(--navy); font-style: italic; }
.cl-finding blockquote cite { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; font-style: normal; }
.cl-suggestion { margin: 8px 0 0; padding: 8px 12px; border-radius: var(--radius-card); background: var(--bg); color: var(--navy); }
.cl-suggestion span { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.cl-task { margin: 8px 0 0; color: var(--navy-600); font-size: 14px; }
.cl-interventions { margin: 8px 0 0; padding-left: 18px; }
.cl-interventions small { display: block; color: var(--muted); }
.cl-finding-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.cl-inline-form:not(:empty) { margin-top: 10px; }
.cl-form { display: grid; gap: 10px; padding: 12px; border-radius: var(--radius-card); background: var(--bg); }
.cl-form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; align-items: end; }
.cl-field { display: grid; gap: 4px; color: var(--navy); font-size: 14px; font-weight: 500; }
.cl-check { display: flex; gap: 8px; align-items: flex-start; color: var(--navy); font-size: 14px; }
.cl-check input, .cl-choice input, .cl-code-options input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--teal); }
.cl-form-status { margin: 0; color: var(--navy-600); font-size: 14px; }
.cl-form-status:empty { display: none; }
.cl-suggestions { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 6px; }
.cl-priority { display: inline-block; margin-right: 8px; padding: 0 7px; border-radius: 999px; font-size: 12px; background: var(--navy-50); color: var(--navy-600); }
.cl-priority-priority { background: var(--risk-bg); color: var(--risk-fg); }
.cl-priority-soon { background: var(--review-bg); color: var(--review-fg); }
.cl-more summary { cursor: pointer; color: var(--navy); font-weight: 600; min-height: 32px; display: flex; align-items: center; }
.cl-more[open] summary { margin-bottom: 10px; }
.cl-report { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.cl-report p { margin: 0; }
.cl-transcript, .cl-messages, .cl-trail { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.cl-transcript li { display: grid; gap: 2px; padding: 8px 12px; border-radius: var(--radius-card); background: var(--bg); }
.cl-transcript li.patient { background: var(--teal-50); }
.cl-transcript li span { color: var(--muted); font-size: 12px; font-weight: 600; }
.cl-transcript li p, .cl-messages li p { margin: 0; }
.cl-transcript li small { color: var(--risk-fg); font-weight: 600; }
.cl-messages li { padding: 8px 12px; border-radius: var(--radius-card); background: var(--bg); max-width: 88%; }
.cl-messages li.inbound { justify-self: end; background: var(--teal-50); }
.cl-messages li small, .cl-trail li small { display: block; color: var(--muted); font-size: 12px; }
.cl-trail li { padding: 0 0 8px 14px; border-left: 2px solid var(--line); }
.cl-complete fieldset { margin: 0 0 10px; padding: 0; border: 0; }
.cl-complete legend { margin-bottom: 6px; font-weight: 600; color: var(--navy); }
.cl-code-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 14px; }
.cl-code-options label { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }

/* Start dialog */
.cl-choice { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; }
.cl-choice legend, .cl-consent legend { margin-bottom: 6px; font-weight: 600; color: var(--navy); }
.cl-choice label { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--white); cursor: pointer; }
.cl-choice label:has(input:checked) { border-color: var(--teal-500); box-shadow: inset 0 0 0 1px var(--teal-500); }
.cl-choice label span { display: grid; gap: 2px; }
.cl-choice small { color: var(--muted); }
.cl-consent { display: grid; gap: 8px; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--white); }
.cl-readiness { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.cl-readiness li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 10px; border-radius: var(--radius-card); background: var(--white); font-size: 14px; }
.cl-readiness li.ok span { color: var(--stable-fg); }
.cl-readiness li.off span { color: var(--review-fg); }
.cl-warnings { margin: 0; padding: 10px 12px 10px 30px; border-radius: var(--radius-card); background: var(--review-bg); color: var(--review-fg); font-size: 14px; }

@media (max-width: 760px) {
  .cl-card { grid-template-columns: auto minmax(0, 1fr); }
  .cl-card-side { grid-column: 1 / -1; grid-template-columns: auto 1fr auto; justify-items: start; align-items: center; text-align: left; }
  .cl-card-side .button { justify-self: end; }
  /* A compact vertical timeline instead of five tall cards. */
  .cl-steps { grid-template-columns: 1fr; gap: 0; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--white); overflow: hidden; }
  .cl-steps li { display: grid; grid-template-columns: 22px minmax(0, 1fr); column-gap: 10px; align-items: start; padding: 8px 12px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
  .cl-steps li:last-child { border-bottom: 0; }
  .cl-steps li::before { grid-row: 1 / span 2; margin: 0; }
  .cl-steps li span, .cl-steps li small { grid-column: 2; }
  .cl-steps li.current { box-shadow: none; background: var(--teal-50); }
  .cl-steps li.error { background: var(--risk-bg); }
  .cl-attention { flex-direction: column; align-items: stretch; }
  .cl-sheet-body { padding: 18px 16px 28px; }
  .cl-sheet-head { margin: -18px -16px 0; padding: 14px 16px 12px; }
  .cl-dialog { width: 100vw; border-left: 0; }
}
@media (pointer: coarse) {
  .cl-filter button, .cl-patient .button, .cl-dialog .button, .cl-more summary { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .cl-dialog[open] { animation: none; }
  .cl-filter button { transition: none; }
}
