/* Statement card (ui.md, Statement card). An AI suggestion has the AI badge and a violet edge
   until the author decides; accepted, edited, and clinician statements have the success edge;
   a rejected one is struck through. The state is always in the badge text too. Source chips
   open a quote popover: anchored under the chip on wide screens (quote-popover.js), a bottom
   sheet on phones. */

.statement-list {
  display: grid;
  gap: var(--space-3);
  margin: 0 0 var(--space-3);
  padding: 0;
  list-style: none;
}

.statement {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-success);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.statement--ai {
  border-left-color: var(--color-ai);
  background: var(--color-ai-bg);
}

.statement--rejected {
  border-left-color: var(--color-border-strong);
  color: var(--color-text-muted);
}

.statement--rejected .statement__text {
  text-decoration: line-through;
}

.statement__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.statement__text {
  margin: 0;
  white-space: pre-wrap;
}

.statement__original {
  margin-top: var(--space-2);
  font-size: var(--text-sm);
}

.statement__original > summary,
.statement__sources-label {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.statement__original > summary {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch-target);
  cursor: pointer;
}

.statement__original p {
  margin: 0;
  color: var(--color-text-muted);
  white-space: pre-wrap;
}

.statement__sources {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.statement__unsupported {
  margin: var(--space-2) 0 0;
  font-size: var(--text-sm);
}

.statement__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.statement__edit {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.source-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-width: var(--touch-target);
  min-height: var(--touch-target);
  justify-content: center;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-primary);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  cursor: pointer;
}

.source-chip--unverified {
  border-color: var(--color-warning);
  color: var(--color-warning);
}

.quote-popover {
  width: min(100% - 2 * var(--space-4), 26rem);
  margin: auto;
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-2);
}

.quote-popover::backdrop {
  background: transparent;
}

.quote-popover__fact {
  margin: 0 0 var(--space-2);
}

/* quote-popover.js places it under its chip on wide screens. */
.quote-popover--anchored {
  position: fixed;
  inset: auto;
  margin: 0;
}

@media (max-width: 639px) {
  .quote-popover {
    width: 100%;
    max-width: none;
    margin: auto 0 0;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
  }
}
