.production-scene-writing-section {
  min-width: 0;
}

.production-scene-writing-section--divided {
  margin-top: 12px;
  border-top: 1px solid var(--ms-color-border);
  padding-top: 12px;
}

.production-scene-writing-section--flush-top {
  margin-top: 0;
}

.production-scene-writing-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.production-scene-writing-header__copy {
  min-width: 0;
}

.production-scene-writing-header__eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ms-color-muted-foreground);
  font-size: var(--ms-text-caption);
  font-weight: 500;
  line-height: 16px;
}

.production-scene-writing-header__title {
  margin: 4px 0 0;
  color: var(--ms-color-foreground);
  font-size: var(--ms-text-body);
  font-weight: 600;
  line-height: 20px;
}

.production-scene-writing-header__description {
  margin: 4px 0 0;
  color: var(--ms-color-muted-foreground);
  font-size: var(--ms-text-label);
  line-height: 20px;
}

.production-scene-writing-header__actions,
.production-scene-writing-badge-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.production-scene-writing-responsive-description {
  display: none;
}

.production-scene-writing-badge,
.production-expression-badge {
  height: 1.5rem;
  border-radius: var(--ms-radius-full);
  padding-inline: var(--ms-space-2);
  font-size: var(--ms-text-tiny);
  line-height: var(--ms-leading-tiny);
}

.production-expression-badge {
  height: 1.25rem;
  padding-inline: 6px;
}

.production-scene-writing-spinner {
  animation: ms-spin 1s linear infinite;
}

.production-scene-reference-grid {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.production-scene-reference-group {
  min-width: 0;
  border-left: 1px solid var(--ms-color-border);
  padding-left: 8px;
}

.production-scene-reference-group__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.production-scene-reference-group__title {
  overflow: hidden;
  margin: 0;
  color: var(--ms-color-muted-foreground);
  font-size: var(--ms-text-label);
  font-weight: 500;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.production-scene-reference-group__count {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  border: 1px solid var(--ms-color-border);
  border-radius: var(--ms-radius-full);
  padding: 0 6px;
  color: var(--ms-color-muted-foreground);
  font-size: var(--ms-text-tiny);
  line-height: 1;
}

.production-scene-reference-group__body {
  display: grid;
  gap: 4px;
  margin-top: 6px;
}

.production-scene-reference-group__empty {
  margin: 0;
  color: var(--ms-color-muted-foreground);
  font-size: var(--ms-text-caption);
  line-height: 16px;
}

.production-scene-reference-item {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  border: 1px solid var(--ms-color-border);
  border-radius: var(--ms-radius-md);
  background: var(--ms-color-surface);
  padding: 4px 6px;
}

.production-scene-reference-item__copy {
  min-width: 0;
  flex: 1;
}

.production-scene-reference-item__title,
.production-scene-reference-item__meta {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.production-scene-reference-item__title {
  color: var(--ms-color-foreground);
  font-size: var(--ms-text-label);
  font-weight: 500;
  line-height: 18px;
}

.production-scene-reference-item__meta {
  color: var(--ms-color-muted-foreground);
  font-size: var(--ms-text-tiny);
  line-height: 14px;
}

.production-scene-reference-item__action {
  flex: 0 0 auto;
}

.production-scene-reference-remove-button {
  width: 1.25rem;
  height: 1.25rem;
}

.production-scene-reference-empty-state,
.production-scene-moment-empty-state {
  margin-top: var(--ms-space-3);
}

.production-scene-reference-binding-row {
  display: grid;
  gap: var(--ms-space-2);
  margin-top: var(--ms-space-3);
}

.production-scene-writing-dialog-content {
  width: min(720px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 32px));
  overflow: hidden;
}

.production-scene-writing-dialog-content--wide {
  width: min(880px, calc(100vw - 32px));
}

.production-scene-writing-dialog-body {
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.production-scene-writing-select-trigger {
  height: 2rem;
  font-size: var(--ms-text-label);
  line-height: var(--ms-leading-label);
}

.production-scene-writing-select-trigger--default,
.production-scene-writing-select-trigger--expression-speaker {
  background: var(--ms-color-background);
}

.production-scene-writing-select-trigger--expression-kind,
.production-scene-writing-select-trigger--expression-speaker {
  width: 100%;
}

.production-scene-writing-select-trigger--expression-speaker {
  margin-top: var(--ms-space-1);
}

.production-scene-writing-action-button {
  gap: 6px;
  padding-inline: var(--ms-space-2);
  font-size: var(--ms-text-label);
  line-height: var(--ms-leading-label);
}

.production-scene-writing-field-grid {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.production-scene-writing-field {
  display: block;
  min-width: 0;
  color: var(--ms-color-muted-foreground);
  font-size: var(--ms-text-label);
  line-height: 18px;
}

.production-scene-writing-field__label {
  display: block;
  margin-bottom: 4px;
}

.production-scene-writing-field--spaced {
  margin-top: var(--ms-space-2);
}

.production-scene-writing-textarea {
  background: var(--ms-color-background);
}

.production-scene-writing-textarea--body-compact {
  min-height: 2.5rem;
  resize: none;
  font-size: var(--ms-text-body);
  line-height: var(--ms-leading-body);
}

.production-scene-writing-textarea--body {
  min-height: 4rem;
  resize: vertical;
  font-size: var(--ms-text-body);
  line-height: 1.5rem;
}

.production-scene-writing-textarea--note {
  min-height: 3rem;
  resize: vertical;
  font-size: var(--ms-text-body);
  line-height: 1.5rem;
}

.production-scene-writing-textarea--speaker {
  min-height: 2.5rem;
  resize: none;
  font-size: var(--ms-text-label);
  line-height: var(--ms-leading-label);
}

.production-scene-writing-textarea--expression {
  min-height: 5rem;
  resize: vertical;
  font-size: var(--ms-text-body);
  line-height: 1.5rem;
}

.production-scene-writing-textarea--expression-note {
  min-height: 3rem;
  resize: vertical;
  font-size: var(--ms-text-label);
  line-height: 1.25rem;
}

.production-scene-writing-action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
}

.production-scene-writing-action-row__leading {
  min-width: 0;
}

.production-scene-writing-action-row__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.production-scene-moment-summary-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--ms-space-3);
  margin-top: 12px;
  border: 1px solid var(--ms-color-border);
  border-radius: var(--ms-radius-md);
  background: var(--ms-color-surface);
  padding: 12px;
}

.production-scene-moment-summary-card__copy {
  min-width: 0;
}

.production-scene-moment-summary-card__topline {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.production-scene-moment-summary-card__title {
  min-width: 0;
  margin: 0;
  color: var(--ms-color-foreground);
  font-size: var(--ms-text-body);
  font-weight: 600;
  line-height: var(--ms-leading-body);
}

.production-scene-moment-summary-card__time {
  border: 1px solid var(--ms-color-border);
  border-radius: var(--ms-radius-full);
  padding: 2px 8px;
  color: var(--ms-color-muted-foreground);
  font-size: var(--ms-text-tiny);
  line-height: var(--ms-leading-tiny);
}

.production-scene-moment-summary-card__description,
.production-scene-moment-summary-card__mood {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  margin: 6px 0 0;
  color: var(--ms-color-muted-foreground);
  font-size: var(--ms-text-label);
  line-height: 1.45;
}

.production-scene-moment-summary-card__description {
  -webkit-line-clamp: 3;
}

.production-scene-moment-summary-card__mood {
  -webkit-line-clamp: 2;
}

.production-scene-moment-summary-card__actions {
  flex: 0 0 auto;
}

.production-expression-line-stack {
  display: grid;
  gap: var(--ms-space-2);
  margin-top: var(--ms-space-3);
}

.production-expression-delete-button {
  margin-top: var(--ms-space-1);
  flex-shrink: 0;
}

.production-expression-line {
  border-bottom: 1px solid var(--ms-color-border);
}

.production-expression-line__summary {
  display: flex;
  cursor: pointer;
  list-style: none;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
}

.production-expression-line__summary::-webkit-details-marker {
  display: none;
}

.production-expression-line__index {
  color: var(--ms-color-muted-foreground);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.production-expression-line__copy {
  min-width: 0;
  flex: 1;
}

.production-expression-line__badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.production-expression-line__speaker {
  color: var(--ms-color-muted-foreground);
  font-size: var(--ms-text-caption);
  line-height: 16px;
}

.production-expression-line__preview,
.production-expression-line__meta {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  margin: 4px 0 0;
}

.production-expression-line__preview {
  -webkit-line-clamp: 2;
  color: var(--ms-color-foreground);
  font-size: var(--ms-text-body);
  line-height: 20px;
}

.production-expression-line__meta {
  -webkit-line-clamp: 1;
  color: var(--ms-color-muted-foreground);
  font-size: var(--ms-text-caption);
  line-height: 16px;
}

.production-expression-line__chevron {
  margin-top: 8px;
  flex: 0 0 auto;
  color: var(--ms-color-muted-foreground);
  transition: transform var(--ms-duration-fast) var(--ms-easing-standard);
}

.production-expression-line[open] .production-expression-line__chevron {
  transform: rotate(180deg);
}

.production-expression-line__body {
  border-top: 1px solid var(--ms-color-border);
  padding: 12px 0;
}

.production-expression-editor-grid {
  display: grid;
  gap: 12px;
}

.production-expression-editor-column {
  display: grid;
  min-width: 0;
  gap: var(--ms-space-2);
}

.production-expression-field {
  display: block;
  color: var(--ms-color-muted-foreground);
  font-size: var(--ms-text-caption);
  line-height: var(--ms-leading-caption);
}

.production-expression-field__label {
  display: block;
}

.production-expression-aux-field-grid {
  display: grid;
  gap: var(--ms-space-2);
}

.production-expression-editor-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 6px;
}

@media (min-width: 640px) {
  .production-scene-writing-responsive-description {
    display: block;
  }

  .production-scene-reference-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 768px) {
  .production-scene-reference-binding-row {
    grid-template-columns: minmax(0, 1fr) 160px auto;
  }

  .production-scene-writing-field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .production-expression-editor-grid {
    grid-template-columns: 150px minmax(0, 1fr) 96px;
  }

  .production-expression-aux-field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .production-scene-reference-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
