.itemsStack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
  max-height: min(48vh, 420px);
  overflow: auto;
  padding-right: 2px;
}

.itemCard {
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.45);
}

.itemCardHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.removeItemBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.18);
  flex-shrink: 0;
}

.removeItemBtn:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.14);
}

.removeItemBtn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/** Matches compact field height; align with input (not label). */
.removeFieldBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--field-height);
  height: var(--field-height);
  min-width: var(--field-height);
  border-radius: var(--radius-sm);
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.18);
  flex-shrink: 0;
}

.removeFieldBtn:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.14);
}

.itemGrid {
  display: grid;
  grid-template-columns: minmax(160px, 2fr) minmax(90px, 1fr) minmax(90px, 1fr) minmax(110px, 1.1fr) minmax(120px, 1.2fr);
  gap: 10px;
  align-items: end;
}

.descField {
  grid-column: 1 / -1;
}

.itemActions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.itemActionsLeft {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.compactSelect {
  width: min(260px, 100%);
  min-height: 32px;
  padding: 6px var(--select-padding-end) 6px 10px;
  font-size: 12px;
  font-family: var(--font-ui);
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: var(--radius-sm);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px;
  cursor: pointer;
}

:global([dir='rtl']) .compactSelect {
  padding: 6px 10px 6px var(--select-padding-end);
  background-position: left 8px center;
}

.compactBtn {
  padding: 6px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.blockSection {
  margin: 16px 0;
  padding-top: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
}

.blockHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.blockTitle {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.templateHint {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

.repeatStack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.repeatRow {
  display: flex;
  align-items: center;
  gap: 8px;
}

.repeatRow > div {
  flex: 1;
  min-width: 0;
}

.fieldNoLabel {
  margin: 0;
}

.fieldNoLabel label {
  display: none;
}

.flexGrow {
  flex: 1;
  min-width: 0;
}

.accountRow {
  display: grid;
  grid-template-columns: 2fr 2fr 3fr 5fr var(--field-height);
  align-items: end;
  gap: 8px;
}

.accountRowPlain {
  align-items: center;
}

.accountCol2,
.accountCol3,
.accountCol5 {
  min-width: 0;
}

.keyPointList {
  margin: 0;
  padding-inline-start: 18px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

@media (max-width: 900px) {
  .itemGrid {
    grid-template-columns: 1fr 1fr;
  }

  .descField {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .itemGrid {
    grid-template-columns: 1fr;
  }

  .descField {
    grid-column: span 1;
  }

  .accountRow {
    grid-template-columns: 1fr var(--field-height);
  }

  .accountCol2,
  .accountCol3,
  .accountCol5 {
    grid-column: 1;
  }

  .itemActions {
    flex-direction: column;
    align-items: stretch;
  }

  .itemActionsLeft {
    flex-direction: column;
    align-items: stretch;
  }

  .compactSelect {
    width: 100%;
  }
}
