.context-card-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 12px 0;
}

.context-card-summary span {
  padding: 7px 9px;
  border: 1px solid var(--bf-line);
  border-radius: 99px;
  background: #121212;
  color: #ddd;
  font-size: 0.72rem;
}

.context-card-actions {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 8px;
  margin-top: 13px;
}

.context-card-actions button {
  min-height: 48px;
}

.context-history {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.context-history article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px;
  border: 1px solid var(--bf-line);
  border-radius: 12px;
  background: #111;
}

.context-history article > div:first-child {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.context-history span,
.context-history small {
  color: var(--bf-muted);
  font-size: 0.72rem;
}

.context-dialog {
  max-height: min(90vh, 780px);
  overflow: auto;
  overscroll-behavior: contain;
}

#contextCheckinForm {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.context-form-section {
  display: grid;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--bf-line);
  border-radius: 13px;
  background: #101010;
}

.context-form-section h3 {
  margin: 0;
  font-size: 1rem;
}

.context-form-section > label,
.context-pain-fields > label,
.context-conditional {
  display: grid;
  gap: 6px;
  color: var(--bf-muted);
  font-size: 0.76rem;
}

.context-form-section fieldset,
.context-scale-grid fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.context-form-section legend,
.context-scale-grid legend {
  margin-bottom: 7px;
  color: #ddd;
  font-size: 0.76rem;
  font-weight: 800;
}

.context-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.context-chips label,
.context-scale label {
  position: relative;
  display: block;
}

.context-chips input,
.context-scale input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.context-chips span {
  display: grid;
  min-height: 44px;
  place-items: center;
  padding: 8px 11px;
  border: 1px solid var(--bf-line-strong);
  border-radius: 99px;
  background: #151515;
  color: #ddd;
  font-size: 0.72rem;
  font-weight: 750;
  cursor: pointer;
}

.context-chips input:checked + span {
  border-color: #fff;
  background: #272727;
  color: #fff;
  box-shadow: 0 0 9px rgba(255, 255, 255, 0.1);
}

.context-chips input:focus-visible + span,
.context-scale input:focus-visible + span {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.context-scale-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.context-scale-grid fieldset {
  padding: 10px;
  border: 1px solid var(--bf-line);
  border-radius: 11px;
}

.context-scale {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
}

.context-scale span {
  display: grid;
  min-height: 42px;
  place-items: center;
  border: 1px solid var(--bf-line-strong);
  border-radius: 8px;
  background: #171717;
  color: var(--bf-muted);
  cursor: pointer;
}

.context-scale input:checked + span {
  border-color: #fff;
  background: #fff;
  color: #090909;
  font-weight: 900;
}

.context-scale-grid small {
  display: block;
  margin-top: 6px;
  color: var(--bf-muted);
  font-size: 0.61rem;
}

.context-pain-fields {
  display: grid;
  gap: 12px;
}

.context-checkbox {
  display: flex !important;
  min-height: 44px;
  align-items: center;
  gap: 9px;
  color: #ddd !important;
}

.context-checkbox input {
  width: 20px;
  height: 20px;
  accent-color: var(--bf-red);
}

.context-review {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--bf-line-strong);
  border-radius: 13px;
  background: #111;
}

.context-review p {
  margin-top: 0;
}

.context-review ul {
  display: grid;
  gap: 7px;
  margin: 0 0 14px;
  padding-left: 20px;
  color: #ddd;
}

.context-review button {
  width: 100%;
  min-height: 44px;
}

.context-dialog-actions {
  position: sticky;
  bottom: -1px;
  display: grid;
  grid-template-columns: 0.8fr 1.4fr;
  gap: 8px;
  margin-top: 14px;
  padding-top: 10px;
  background: linear-gradient(transparent, #121212 18%);
}

.context-dialog-actions button {
  min-height: 48px;
}

.context-dialog-actions #confirmContextCheckin {
  grid-column: 2;
}

@media (max-width: 430px) {
  .context-scale-grid {
    grid-template-columns: 1fr;
  }

  .context-history article {
    align-items: stretch;
    flex-direction: column;
  }

  .context-history .record-actions {
    width: 100%;
  }

  .context-history .record-actions button {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .context-chips span,
  .context-scale span {
    transition: none;
  }
}
